orynacode-ai 1.16.3 → 1.16.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 (303) hide show
  1. package/package.json +3 -4
  2. package/parsers-config.ts +1 -386
  3. package/script/build.ts +1 -1
  4. package/script/schema.ts +2 -2
  5. package/script/trace-imports.ts +1 -1
  6. package/src/cli/cmd/{tui/attach.ts → attach.ts} +40 -46
  7. package/src/cli/cmd/prompt-display.ts +1 -48
  8. package/src/cli/cmd/run/demo.ts +1 -1
  9. package/src/cli/cmd/run/entry.body.ts +11 -0
  10. package/src/cli/cmd/run/footer.command.tsx +298 -112
  11. package/src/cli/cmd/run/footer.menu.tsx +84 -37
  12. package/src/cli/cmd/run/footer.permission.tsx +9 -2
  13. package/src/cli/cmd/run/footer.prompt.tsx +135 -30
  14. package/src/cli/cmd/run/footer.question.tsx +2 -1
  15. package/src/cli/cmd/run/footer.subagent.tsx +9 -1
  16. package/src/cli/cmd/run/footer.ts +104 -43
  17. package/src/cli/cmd/run/footer.view.tsx +475 -425
  18. package/src/cli/cmd/run/footer.width.ts +27 -0
  19. package/src/cli/cmd/run/prompt.editor.ts +157 -0
  20. package/src/cli/cmd/run/prompt.shared.ts +7 -1
  21. package/src/cli/cmd/run/runtime.boot.ts +3 -11
  22. package/src/cli/cmd/run/runtime.lifecycle.ts +72 -11
  23. package/src/cli/cmd/run/runtime.queue.ts +12 -10
  24. package/src/cli/cmd/run/runtime.ts +49 -26
  25. package/src/cli/cmd/run/scrollback.surface.ts +14 -1
  26. package/src/cli/cmd/run/scrollback.writer.tsx +19 -1
  27. package/src/cli/cmd/run/session-replay.ts +78 -5
  28. package/src/cli/cmd/run/splash.ts +22 -48
  29. package/src/cli/cmd/run/stream.transport.ts +6 -9
  30. package/src/cli/cmd/run/subagent-data.ts +77 -45
  31. package/src/cli/cmd/run/theme.ts +138 -51
  32. package/src/cli/cmd/run/turn-summary.ts +47 -0
  33. package/src/cli/cmd/run/types.ts +10 -2
  34. package/src/cli/cmd/{tui/thread.ts → tui.ts} +40 -40
  35. package/src/cli/tui/layer.ts +7 -0
  36. package/src/config/tui-host-attention.ts +21 -0
  37. package/src/{cli/cmd/tui/config → config}/tui-migrate.ts +4 -4
  38. package/src/{cli/cmd/tui/config → config}/tui.ts +37 -53
  39. package/src/index.ts +2 -2
  40. package/src/mcp/index.ts +20 -6
  41. package/src/{cli/cmd/tui/context/agent.tsx → oryna/agent-signal.ts} +2 -1
  42. package/src/oryna/agent.ts +19 -11
  43. package/src/oryna/reply-service.ts +3 -1
  44. package/src/plugin/tui/internal.ts +12 -0
  45. package/src/{cli/cmd/tui/plugin → plugin/tui}/runtime.ts +65 -22
  46. package/src/server/routes/instance/httpapi/api.ts +4 -2
  47. package/src/server/routes/instance/httpapi/groups/reference.ts +60 -0
  48. package/src/server/routes/instance/httpapi/groups/tui.ts +1 -1
  49. package/src/server/routes/instance/httpapi/handlers/reference.ts +27 -0
  50. package/src/server/routes/instance/httpapi/handlers/tui.ts +1 -1
  51. package/src/server/routes/instance/httpapi/middleware/authorization.ts +4 -1
  52. package/src/server/routes/instance/httpapi/server.ts +12 -8
  53. package/src/session/session.ts +2 -0
  54. package/src/temporary.ts +1 -1
  55. package/src/tool/registry.ts +1 -25
  56. package/src/tool/reply.ts +1 -1
  57. package/src/tool/task.ts +4 -3
  58. package/src/util/error.ts +1 -88
  59. package/src/util/locale.ts +2 -86
  60. package/src/util/process.ts +2 -1
  61. package/src/util/record.ts +1 -3
  62. package/test/cli/cmd/tui/attention.test.ts +2 -2
  63. package/test/cli/run/footer.view.test.tsx +443 -35
  64. package/test/cli/run/footer.width.test.ts +35 -0
  65. package/test/cli/run/prompt.editor.test.ts +101 -0
  66. package/test/cli/run/prompt.shared.test.ts +0 -32
  67. package/test/cli/run/runtime.boot.test.ts +2 -1
  68. package/test/cli/run/runtime.queue.test.ts +16 -0
  69. package/test/cli/run/runtime.test.ts +238 -0
  70. package/test/cli/run/scrollback.surface.test.ts +17 -0
  71. package/test/cli/run/session-replay.test.ts +248 -12
  72. package/test/cli/run/stream.transport.test.ts +2 -2
  73. package/test/cli/run/subagent-data.test.ts +98 -7
  74. package/test/cli/run/theme.test.ts +25 -0
  75. package/test/cli/tui/attach.test.ts +11 -0
  76. package/test/cli/tui/editor-context-zed.test.ts +1 -6
  77. package/test/cli/tui/editor-context.test.tsx +13 -4
  78. package/test/cli/tui/plugin-add.test.ts +2 -2
  79. package/test/cli/tui/plugin-install.test.ts +2 -2
  80. package/test/cli/tui/plugin-lifecycle.test.ts +1 -1
  81. package/test/cli/tui/plugin-loader-entrypoint.test.ts +2 -2
  82. package/test/cli/tui/plugin-loader-pure.test.ts +2 -2
  83. package/test/cli/tui/plugin-loader.test.ts +3 -3
  84. package/test/cli/tui/plugin-toggle.test.ts +2 -2
  85. package/test/cli/tui/thread.test.ts +9 -1
  86. package/test/config/tui.test.ts +14 -6
  87. package/test/fixture/tui-environment.tsx +32 -0
  88. package/test/fixture/tui-plugin.ts +1 -1
  89. package/test/fixture/tui-runtime.ts +17 -25
  90. package/test/fixture/tui-sdk.ts +1 -1
  91. package/test/mcp/lifecycle.test.ts +90 -0
  92. package/test/mcp/oauth-auto-connect.test.ts +38 -0
  93. package/test/mcp/oauth-browser.test.ts +4 -0
  94. package/test/preload.ts +5 -1
  95. package/test/server/httpapi-authorization.test.ts +6 -6
  96. package/test/server/httpapi-exercise/index.ts +13 -10
  97. package/test/server/httpapi-public-openapi.test.ts +9 -9
  98. package/test/server/httpapi-query-schema-drift.test.ts +2 -2
  99. package/test/server/httpapi-reference.test.ts +56 -0
  100. package/test/server/httpapi-sdk.test.ts +1 -1
  101. package/test/server/httpapi-session.test.ts +4 -4
  102. package/test/session/compaction.test.ts +2 -0
  103. package/test/session/prompt.test.ts +2 -0
  104. package/test/tool/__snapshots__/parameters.test.ts.snap +1 -1
  105. package/test/tool/skill.test.ts +3 -0
  106. package/test/util/error.test.ts +0 -48
  107. package/tsconfig.json +0 -1
  108. package/src/cli/cmd/tui/app.tsx +0 -1113
  109. package/src/cli/cmd/tui/attention.ts +0 -262
  110. package/src/cli/cmd/tui/component/bg-pulse-render.ts +0 -436
  111. package/src/cli/cmd/tui/component/bg-pulse.tsx +0 -99
  112. package/src/cli/cmd/tui/component/border.tsx +0 -21
  113. package/src/cli/cmd/tui/component/command-palette.tsx +0 -79
  114. package/src/cli/cmd/tui/component/dialog-agent.tsx +0 -31
  115. package/src/cli/cmd/tui/component/dialog-console-org.tsx +0 -103
  116. package/src/cli/cmd/tui/component/dialog-mcp.tsx +0 -85
  117. package/src/cli/cmd/tui/component/dialog-model.tsx +0 -185
  118. package/src/cli/cmd/tui/component/dialog-move-session.tsx +0 -240
  119. package/src/cli/cmd/tui/component/dialog-provider.tsx +0 -687
  120. package/src/cli/cmd/tui/component/dialog-retry-action.tsx +0 -160
  121. package/src/cli/cmd/tui/component/dialog-session-delete-failed.tsx +0 -99
  122. package/src/cli/cmd/tui/component/dialog-session-list.tsx +0 -318
  123. package/src/cli/cmd/tui/component/dialog-session-rename.tsx +0 -31
  124. package/src/cli/cmd/tui/component/dialog-skill.tsx +0 -36
  125. package/src/cli/cmd/tui/component/dialog-stash.tsx +0 -87
  126. package/src/cli/cmd/tui/component/dialog-status.tsx +0 -168
  127. package/src/cli/cmd/tui/component/dialog-tag.tsx +0 -47
  128. package/src/cli/cmd/tui/component/dialog-theme-list.tsx +0 -50
  129. package/src/cli/cmd/tui/component/dialog-variant.tsx +0 -39
  130. package/src/cli/cmd/tui/component/dialog-workspace-create.tsx +0 -313
  131. package/src/cli/cmd/tui/component/dialog-workspace-file-changes.tsx +0 -144
  132. package/src/cli/cmd/tui/component/dialog-workspace-list.tsx +0 -112
  133. package/src/cli/cmd/tui/component/dialog-workspace-unavailable.tsx +0 -69
  134. package/src/cli/cmd/tui/component/error-component.tsx +0 -81
  135. package/src/cli/cmd/tui/component/logo.tsx +0 -885
  136. package/src/cli/cmd/tui/component/plugin-route-missing.tsx +0 -14
  137. package/src/cli/cmd/tui/component/prompt/autocomplete.tsx +0 -799
  138. package/src/cli/cmd/tui/component/prompt/cwd.ts +0 -0
  139. package/src/cli/cmd/tui/component/prompt/frecency.tsx +0 -90
  140. package/src/cli/cmd/tui/component/prompt/history.tsx +0 -117
  141. package/src/cli/cmd/tui/component/prompt/index.tsx +0 -1725
  142. package/src/cli/cmd/tui/component/prompt/move.tsx +0 -192
  143. package/src/cli/cmd/tui/component/prompt/part.ts +0 -31
  144. package/src/cli/cmd/tui/component/prompt/stash.tsx +0 -101
  145. package/src/cli/cmd/tui/component/prompt/traits.ts +0 -35
  146. package/src/cli/cmd/tui/component/prompt/workspace.tsx +0 -137
  147. package/src/cli/cmd/tui/component/spinner.tsx +0 -24
  148. package/src/cli/cmd/tui/component/startup-loading.tsx +0 -63
  149. package/src/cli/cmd/tui/component/todo-item.tsx +0 -32
  150. package/src/cli/cmd/tui/component/use-connected.tsx +0 -9
  151. package/src/cli/cmd/tui/component/workspace-label.tsx +0 -19
  152. package/src/cli/cmd/tui/config/keybind.ts +0 -467
  153. package/src/cli/cmd/tui/config/tui-schema.ts +0 -88
  154. package/src/cli/cmd/tui/context/aggregate-failures.ts +0 -51
  155. package/src/cli/cmd/tui/context/args.tsx +0 -15
  156. package/src/cli/cmd/tui/context/directory.ts +0 -15
  157. package/src/cli/cmd/tui/context/editor-zed.ts +0 -287
  158. package/src/cli/cmd/tui/context/editor.ts +0 -469
  159. package/src/cli/cmd/tui/context/event.ts +0 -38
  160. package/src/cli/cmd/tui/context/exit.tsx +0 -42
  161. package/src/cli/cmd/tui/context/helper.tsx +0 -25
  162. package/src/cli/cmd/tui/context/kv.tsx +0 -76
  163. package/src/cli/cmd/tui/context/local.tsx +0 -510
  164. package/src/cli/cmd/tui/context/path-format.tsx +0 -39
  165. package/src/cli/cmd/tui/context/project.tsx +0 -111
  166. package/src/cli/cmd/tui/context/prompt.tsx +0 -18
  167. package/src/cli/cmd/tui/context/route.tsx +0 -52
  168. package/src/cli/cmd/tui/context/sdk.tsx +0 -142
  169. package/src/cli/cmd/tui/context/sync-v2.tsx +0 -447
  170. package/src/cli/cmd/tui/context/sync.tsx +0 -628
  171. package/src/cli/cmd/tui/context/theme/aura.json +0 -69
  172. package/src/cli/cmd/tui/context/theme/ayu.json +0 -80
  173. package/src/cli/cmd/tui/context/theme/carbonfox.json +0 -248
  174. package/src/cli/cmd/tui/context/theme/catppuccin-frappe.json +0 -230
  175. package/src/cli/cmd/tui/context/theme/catppuccin-macchiato.json +0 -230
  176. package/src/cli/cmd/tui/context/theme/catppuccin.json +0 -112
  177. package/src/cli/cmd/tui/context/theme/cobalt2.json +0 -225
  178. package/src/cli/cmd/tui/context/theme/cursor.json +0 -249
  179. package/src/cli/cmd/tui/context/theme/dracula.json +0 -219
  180. package/src/cli/cmd/tui/context/theme/everforest.json +0 -241
  181. package/src/cli/cmd/tui/context/theme/flexoki.json +0 -237
  182. package/src/cli/cmd/tui/context/theme/github.json +0 -233
  183. package/src/cli/cmd/tui/context/theme/gruvbox.json +0 -242
  184. package/src/cli/cmd/tui/context/theme/kanagawa.json +0 -77
  185. package/src/cli/cmd/tui/context/theme/lucent-orng.json +0 -234
  186. package/src/cli/cmd/tui/context/theme/material.json +0 -235
  187. package/src/cli/cmd/tui/context/theme/matrix.json +0 -77
  188. package/src/cli/cmd/tui/context/theme/mercury.json +0 -252
  189. package/src/cli/cmd/tui/context/theme/monokai.json +0 -221
  190. package/src/cli/cmd/tui/context/theme/nightowl.json +0 -221
  191. package/src/cli/cmd/tui/context/theme/nord.json +0 -223
  192. package/src/cli/cmd/tui/context/theme/one-dark.json +0 -84
  193. package/src/cli/cmd/tui/context/theme/opencode.json +0 -245
  194. package/src/cli/cmd/tui/context/theme/orng.json +0 -249
  195. package/src/cli/cmd/tui/context/theme/oryna.json +0 -95
  196. package/src/cli/cmd/tui/context/theme/osaka-jade.json +0 -93
  197. package/src/cli/cmd/tui/context/theme/palenight.json +0 -222
  198. package/src/cli/cmd/tui/context/theme/rosepine.json +0 -234
  199. package/src/cli/cmd/tui/context/theme/solarized.json +0 -223
  200. package/src/cli/cmd/tui/context/theme/synthwave84.json +0 -226
  201. package/src/cli/cmd/tui/context/theme/tokyonight.json +0 -243
  202. package/src/cli/cmd/tui/context/theme/vercel.json +0 -245
  203. package/src/cli/cmd/tui/context/theme/vesper.json +0 -218
  204. package/src/cli/cmd/tui/context/theme/zenburn.json +0 -223
  205. package/src/cli/cmd/tui/context/theme.tsx +0 -1341
  206. package/src/cli/cmd/tui/context/thinking.ts +0 -67
  207. package/src/cli/cmd/tui/context/tui-config.tsx +0 -9
  208. package/src/cli/cmd/tui/feature-plugins/home/footer.tsx +0 -98
  209. package/src/cli/cmd/tui/feature-plugins/home/tips-view.tsx +0 -288
  210. package/src/cli/cmd/tui/feature-plugins/home/tips.tsx +0 -59
  211. package/src/cli/cmd/tui/feature-plugins/session/dialog.tsx +0 -356
  212. package/src/cli/cmd/tui/feature-plugins/session/index.tsx +0 -32
  213. package/src/cli/cmd/tui/feature-plugins/session/preview-pane.tsx +0 -288
  214. package/src/cli/cmd/tui/feature-plugins/session/util.tsx +0 -54
  215. package/src/cli/cmd/tui/feature-plugins/sidebar/context.tsx +0 -65
  216. package/src/cli/cmd/tui/feature-plugins/sidebar/files.tsx +0 -70
  217. package/src/cli/cmd/tui/feature-plugins/sidebar/footer.tsx +0 -96
  218. package/src/cli/cmd/tui/feature-plugins/sidebar/lsp.tsx +0 -65
  219. package/src/cli/cmd/tui/feature-plugins/sidebar/mcp.tsx +0 -97
  220. package/src/cli/cmd/tui/feature-plugins/sidebar/todo.tsx +0 -49
  221. package/src/cli/cmd/tui/feature-plugins/system/diff-viewer-file-tree-utils.ts +0 -232
  222. package/src/cli/cmd/tui/feature-plugins/system/diff-viewer-file-tree.tsx +0 -162
  223. package/src/cli/cmd/tui/feature-plugins/system/diff-viewer-ui.tsx +0 -103
  224. package/src/cli/cmd/tui/feature-plugins/system/diff-viewer.tsx +0 -1058
  225. package/src/cli/cmd/tui/feature-plugins/system/notifications.ts +0 -94
  226. package/src/cli/cmd/tui/feature-plugins/system/plugins.tsx +0 -269
  227. package/src/cli/cmd/tui/feature-plugins/system/session-v2.tsx +0 -1184
  228. package/src/cli/cmd/tui/feature-plugins/system/which-key.tsx +0 -608
  229. package/src/cli/cmd/tui/keymap.tsx +0 -283
  230. package/src/cli/cmd/tui/layer.ts +0 -6
  231. package/src/cli/cmd/tui/plugin/api.tsx +0 -390
  232. package/src/cli/cmd/tui/plugin/command-shim.ts +0 -109
  233. package/src/cli/cmd/tui/plugin/internal.ts +0 -42
  234. package/src/cli/cmd/tui/plugin/slots.tsx +0 -60
  235. package/src/cli/cmd/tui/routes/home/session-destination.tsx +0 -39
  236. package/src/cli/cmd/tui/routes/home.tsx +0 -149
  237. package/src/cli/cmd/tui/routes/session/dialog-fork-from-timeline.tsx +0 -76
  238. package/src/cli/cmd/tui/routes/session/dialog-message.tsx +0 -108
  239. package/src/cli/cmd/tui/routes/session/dialog-subagent.tsx +0 -26
  240. package/src/cli/cmd/tui/routes/session/dialog-timeline.tsx +0 -47
  241. package/src/cli/cmd/tui/routes/session/footer.tsx +0 -91
  242. package/src/cli/cmd/tui/routes/session/index.tsx +0 -2629
  243. package/src/cli/cmd/tui/routes/session/permission.tsx +0 -729
  244. package/src/cli/cmd/tui/routes/session/question.tsx +0 -514
  245. package/src/cli/cmd/tui/routes/session/sidebar.tsx +0 -102
  246. package/src/cli/cmd/tui/routes/session/subagent-footer.tsx +0 -132
  247. package/src/cli/cmd/tui/ui/dialog-alert.tsx +0 -66
  248. package/src/cli/cmd/tui/ui/dialog-confirm.tsx +0 -108
  249. package/src/cli/cmd/tui/ui/dialog-export-options.tsx +0 -217
  250. package/src/cli/cmd/tui/ui/dialog-help.tsx +0 -40
  251. package/src/cli/cmd/tui/ui/dialog-prompt.tsx +0 -126
  252. package/src/cli/cmd/tui/ui/dialog-select.tsx +0 -712
  253. package/src/cli/cmd/tui/ui/dialog.tsx +0 -218
  254. package/src/cli/cmd/tui/ui/link.tsx +0 -34
  255. package/src/cli/cmd/tui/ui/spinner.ts +0 -368
  256. package/src/cli/cmd/tui/ui/toast.tsx +0 -102
  257. package/src/cli/cmd/tui/util/audio.ts +0 -58
  258. package/src/cli/cmd/tui/util/clipboard.ts +0 -181
  259. package/src/cli/cmd/tui/util/collapse-tool-output.ts +0 -19
  260. package/src/cli/cmd/tui/util/editor.ts +0 -43
  261. package/src/cli/cmd/tui/util/layout.ts +0 -25
  262. package/src/cli/cmd/tui/util/model.ts +0 -23
  263. package/src/cli/cmd/tui/util/provider-origin.ts +0 -7
  264. package/src/cli/cmd/tui/util/revert-diff.ts +0 -18
  265. package/src/cli/cmd/tui/util/scroll.ts +0 -25
  266. package/src/cli/cmd/tui/util/selection.ts +0 -73
  267. package/src/cli/cmd/tui/util/signal.ts +0 -41
  268. package/src/cli/cmd/tui/util/transcript.ts +0 -112
  269. package/src/cli/cmd/tui/win32.ts +0 -130
  270. package/src/util/format.ts +0 -20
  271. package/test/cli/cmd/tui/aggregate-failures.test.ts +0 -93
  272. package/test/cli/cmd/tui/dialog-workspace-create.test.ts +0 -28
  273. package/test/cli/cmd/tui/model-options.test.ts +0 -30
  274. package/test/cli/cmd/tui/notifications.test.ts +0 -267
  275. package/test/cli/cmd/tui/prompt-history.test.ts +0 -44
  276. package/test/cli/cmd/tui/prompt-part.test.ts +0 -77
  277. package/test/cli/cmd/tui/prompt-traits.test.ts +0 -29
  278. package/test/cli/cmd/tui/provider-options.test.ts +0 -29
  279. package/test/cli/cmd/tui/sync-fixture.tsx +0 -64
  280. package/test/cli/cmd/tui/sync-live-hydration.test.tsx +0 -278
  281. package/test/cli/cmd/tui/sync-undefined-messages.test.tsx +0 -47
  282. package/test/cli/cmd/tui/sync.test.tsx +0 -70
  283. package/test/cli/tui/__snapshots__/inline-tool-wrap-snapshot.test.tsx.snap +0 -72
  284. package/test/cli/tui/app-lifecycle.test.ts +0 -261
  285. package/test/cli/tui/dialog-prompt.test.tsx +0 -146
  286. package/test/cli/tui/diff-viewer-file-tree-utils.test.ts +0 -323
  287. package/test/cli/tui/diff-viewer-file-tree.test.tsx +0 -197
  288. package/test/cli/tui/diff-viewer.test.tsx +0 -230
  289. package/test/cli/tui/inline-tool-wrap-snapshot.test.tsx +0 -232
  290. package/test/cli/tui/keymap.test.tsx +0 -136
  291. package/test/cli/tui/prompt-submit-race.test.ts +0 -98
  292. package/test/cli/tui/revert-diff.test.ts +0 -35
  293. package/test/cli/tui/slot-replace.test.tsx +0 -50
  294. package/test/cli/tui/sync-v2.test.tsx +0 -558
  295. package/test/cli/tui/theme-store.test.ts +0 -76
  296. package/test/cli/tui/thinking.test.ts +0 -36
  297. package/test/cli/tui/transcript.test.ts +0 -426
  298. package/test/cli/tui/use-event.test.tsx +0 -145
  299. package/test/util/format.test.ts +0 -59
  300. /package/src/cli/{cmd/tui → tui}/validate-session.ts +0 -0
  301. /package/src/cli/{cmd/tui → tui}/worker.ts +0 -0
  302. /package/src/{cli/cmd/tui/config/cwd.ts → config/tui-cwd.ts} +0 -0
  303. /package/src/{cli/cmd/tui/event.ts → server/tui-event.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "1.16.3",
3
+ "version": "1.16.4",
4
4
  "name": "orynacode-ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -80,7 +80,7 @@
80
80
  "@effect/opentelemetry": "catalog:",
81
81
  "@effect/platform-node": "catalog:",
82
82
  "@gitlab/opencode-gitlab-auth": "1.3.3",
83
- "@modelcontextprotocol/sdk": "1.27.1",
83
+ "@modelcontextprotocol/sdk": "1.29.0",
84
84
  "@octokit/graphql": "9.0.2",
85
85
  "@octokit/rest": "catalog:",
86
86
  "@openauthjs/openauth": "catalog:",
@@ -89,7 +89,7 @@
89
89
  "@opencode-ai/script": "workspace:*",
90
90
  "@opencode-ai/sdk": "workspace:*",
91
91
  "@opencode-ai/server": "workspace:*",
92
- "@opencode-ai/ui": "workspace:*",
92
+ "@opencode-ai/tui": "workspace:*",
93
93
  "@openrouter/ai-sdk-provider": "2.9.0",
94
94
  "@opentelemetry/api": "1.9.0",
95
95
  "@opentelemetry/context-async-hooks": "2.6.1",
@@ -111,7 +111,6 @@
111
111
  "ai-gateway-provider": "3.1.2",
112
112
  "bonjour-service": "1.3.0",
113
113
  "chokidar": "4.0.3",
114
- "clipboardy": "4.0.0",
115
114
  "cross-spawn": "catalog:",
116
115
  "decimal.js": "10.5.0",
117
116
  "diff": "catalog:",
package/parsers-config.ts CHANGED
@@ -1,386 +1 @@
1
- export default {
2
- // NOTE: FOR markdown, javascript and typescript, we use the opentui built-in parsers
3
- // Warn: when taking queries from the nvim-treesitter repo, make sure to include the query dependencies as well
4
- // marked with for example `; inherits: ecma` at the top of the file. Just put the dependencies before the actual query.
5
- // ALSO: Some queries use breaking changes in the nvim-treesitter repo, that are not compatible with the (web-)tree-sitter parser.
6
- parsers: [
7
- {
8
- filetype: "python",
9
- wasm: "https://github.com/tree-sitter/tree-sitter-python/releases/download/v0.23.6/tree-sitter-python.wasm",
10
- queries: {
11
- highlights: [
12
- // NOTE: This nvim-treesitter query is currently broken, because the parser is not compatible with the query apparently.
13
- // it is using "except" nodes that the parser is complaining about, but it has been in the query for 3+ years.
14
- // Unclear.
15
- // "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/python/highlights.scm",
16
- "https://github.com/tree-sitter/tree-sitter-python/raw/refs/heads/master/queries/highlights.scm",
17
- ],
18
- locals: [
19
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/python/locals.scm",
20
- ],
21
- },
22
- },
23
- {
24
- filetype: "rust",
25
- wasm: "https://github.com/tree-sitter/tree-sitter-rust/releases/download/v0.24.0/tree-sitter-rust.wasm",
26
- queries: {
27
- highlights: [
28
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/rust/highlights.scm",
29
- ],
30
- locals: [
31
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/rust/locals.scm",
32
- ],
33
- },
34
- },
35
- {
36
- filetype: "go",
37
- wasm: "https://github.com/tree-sitter/tree-sitter-go/releases/download/v0.25.0/tree-sitter-go.wasm",
38
- queries: {
39
- highlights: [
40
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/go/highlights.scm",
41
- ],
42
- locals: [
43
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/go/locals.scm",
44
- ],
45
- },
46
- },
47
- {
48
- filetype: "cpp",
49
- wasm: "https://github.com/tree-sitter/tree-sitter-cpp/releases/download/v0.23.4/tree-sitter-cpp.wasm",
50
- queries: {
51
- highlights: [
52
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/cpp/highlights.scm",
53
- ],
54
- locals: [
55
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/cpp/locals.scm",
56
- ],
57
- },
58
- },
59
- {
60
- filetype: "csharp",
61
- wasm: "https://github.com/tree-sitter/tree-sitter-c-sharp/releases/download/v0.23.1/tree-sitter-c_sharp.wasm",
62
- queries: {
63
- highlights: [
64
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/c_sharp/highlights.scm",
65
- ],
66
- locals: [
67
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/c_sharp/locals.scm",
68
- ],
69
- },
70
- },
71
- {
72
- filetype: "bash",
73
- wasm: "https://github.com/tree-sitter/tree-sitter-bash/releases/download/v0.25.0/tree-sitter-bash.wasm",
74
- queries: {
75
- highlights: [
76
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/bash/highlights.scm",
77
- ],
78
- },
79
- },
80
- {
81
- filetype: "c",
82
- wasm: "https://github.com/tree-sitter/tree-sitter-c/releases/download/v0.24.1/tree-sitter-c.wasm",
83
- queries: {
84
- highlights: [
85
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/c/highlights.scm",
86
- ],
87
- locals: [
88
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/c/locals.scm",
89
- ],
90
- },
91
- },
92
- {
93
- filetype: "java",
94
- wasm: "https://github.com/tree-sitter/tree-sitter-java/releases/download/v0.23.5/tree-sitter-java.wasm",
95
- queries: {
96
- highlights: [
97
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/java/highlights.scm",
98
- ],
99
- locals: [
100
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/java/locals.scm",
101
- ],
102
- },
103
- },
104
- {
105
- filetype: "kotlin",
106
- wasm: "https://github.com/fwcd/tree-sitter-kotlin/releases/download/0.3.8/tree-sitter-kotlin.wasm",
107
- queries: {
108
- highlights: ["https://raw.githubusercontent.com/fwcd/tree-sitter-kotlin/0.3.8/queries/highlights.scm"],
109
- locals: ["https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/master/queries/kotlin/locals.scm"],
110
- },
111
- },
112
- {
113
- filetype: "ruby",
114
- wasm: "https://github.com/tree-sitter/tree-sitter-ruby/releases/download/v0.23.1/tree-sitter-ruby.wasm",
115
- queries: {
116
- highlights: [
117
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/ruby/highlights.scm",
118
- ],
119
- locals: [
120
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/ruby/locals.scm",
121
- ],
122
- },
123
- },
124
- {
125
- filetype: "php",
126
- wasm: "https://github.com/tree-sitter/tree-sitter-php/releases/download/v0.24.2/tree-sitter-php.wasm",
127
- queries: {
128
- highlights: [
129
- // NOTE: This nvim-treesitter query is currently broken, because the parser is not compatible with the query apparently.
130
- // "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/php/highlights.scm",
131
- "https://github.com/tree-sitter/tree-sitter-php/raw/refs/heads/master/queries/highlights.scm",
132
- ],
133
- },
134
- },
135
- {
136
- filetype: "scala",
137
- wasm: "https://github.com/tree-sitter/tree-sitter-scala/releases/download/v0.24.0/tree-sitter-scala.wasm",
138
- queries: {
139
- highlights: [
140
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/scala/highlights.scm",
141
- ],
142
- },
143
- },
144
- {
145
- filetype: "html",
146
- wasm: "https://github.com/tree-sitter/tree-sitter-html/releases/download/v0.23.2/tree-sitter-html.wasm",
147
- queries: {
148
- highlights: [
149
- // NOTE: This nvim-treesitter query is currently broken, because the parser is not compatible with the query apparently.
150
- // "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/html/highlights.scm",
151
- "https://github.com/tree-sitter/tree-sitter-html/raw/refs/heads/master/queries/highlights.scm",
152
- ],
153
- // TODO: Injections not working for some reason
154
- // injections: [
155
- // "https://github.com/tree-sitter/tree-sitter-html/raw/refs/heads/master/queries/injections.scm",
156
- // ],
157
- },
158
- // injectionMapping: {
159
- // nodeTypes: {
160
- // script_element: "javascript",
161
- // style_element: "css",
162
- // },
163
- // infoStringMap: {
164
- // javascript: "javascript",
165
- // css: "css",
166
- // },
167
- // },
168
- },
169
- {
170
- filetype: "vue",
171
- wasm: "https://github.com/anomalyco/tree-sitter-vue/releases/download/v0.1.2/tree-sitter-vue.wasm",
172
- queries: {
173
- highlights: [
174
- "https://raw.githubusercontent.com/anomalyco/tree-sitter-vue/v0.1.2/queries/html_tags/highlights.scm",
175
- "https://raw.githubusercontent.com/anomalyco/tree-sitter-vue/v0.1.2/queries/vue/highlights.scm",
176
- ],
177
- },
178
- },
179
- {
180
- filetype: "hcl",
181
- wasm: "https://github.com/tree-sitter-grammars/tree-sitter-hcl/releases/download/v1.2.0/tree-sitter-hcl.wasm",
182
- queries: {
183
- highlights: [
184
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/master/queries/hcl/highlights.scm",
185
- ],
186
- },
187
- },
188
- {
189
- filetype: "json",
190
- wasm: "https://github.com/tree-sitter/tree-sitter-json/releases/download/v0.24.8/tree-sitter-json.wasm",
191
- queries: {
192
- highlights: [
193
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/json/highlights.scm",
194
- ],
195
- },
196
- },
197
- {
198
- filetype: "yaml",
199
- wasm: "https://github.com/tree-sitter-grammars/tree-sitter-yaml/releases/download/v0.7.2/tree-sitter-yaml.wasm",
200
- queries: {
201
- highlights: [
202
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/yaml/highlights.scm",
203
- ],
204
- },
205
- },
206
- {
207
- filetype: "haskell",
208
- wasm: "https://github.com/tree-sitter/tree-sitter-haskell/releases/download/v0.23.1/tree-sitter-haskell.wasm",
209
- queries: {
210
- highlights: [
211
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/haskell/highlights.scm",
212
- ],
213
- },
214
- },
215
- {
216
- filetype: "css",
217
- wasm: "https://github.com/tree-sitter/tree-sitter-css/releases/download/v0.25.0/tree-sitter-css.wasm",
218
- queries: {
219
- highlights: [
220
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/css/highlights.scm",
221
- ],
222
- },
223
- },
224
- {
225
- filetype: "julia",
226
- wasm: "https://github.com/tree-sitter/tree-sitter-julia/releases/download/v0.23.1/tree-sitter-julia.wasm",
227
- queries: {
228
- highlights: [
229
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/julia/highlights.scm",
230
- ],
231
- },
232
- },
233
- {
234
- filetype: "lua",
235
- wasm: "https://github.com/tree-sitter-grammars/tree-sitter-lua/releases/download/v0.5.0/tree-sitter-lua.wasm",
236
- queries: {
237
- highlights: [
238
- "https://raw.githubusercontent.com/tree-sitter-grammars/tree-sitter-lua/v0.5.0/queries/highlights.scm",
239
- ],
240
- locals: ["https://raw.githubusercontent.com/tree-sitter-grammars/tree-sitter-lua/v0.5.0/queries/locals.scm"],
241
- },
242
- },
243
- {
244
- filetype: "ocaml",
245
- wasm: "https://github.com/tree-sitter/tree-sitter-ocaml/releases/download/v0.24.2/tree-sitter-ocaml.wasm",
246
- queries: {
247
- highlights: [
248
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/ocaml/highlights.scm",
249
- ],
250
- },
251
- },
252
- {
253
- filetype: "clojure",
254
- // temporarily using fork to fix issues
255
- wasm: "https://github.com/anomalyco/tree-sitter-clojure/releases/download/v0.0.1/tree-sitter-clojure.wasm",
256
- queries: {
257
- highlights: [
258
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/clojure/highlights.scm",
259
- ],
260
- },
261
- },
262
- {
263
- filetype: "swift",
264
- wasm: "https://github.com/alex-pinkus/tree-sitter-swift/releases/download/0.7.1/tree-sitter-swift.wasm",
265
- queries: {
266
- highlights: [
267
- // NOTE: Using parser repo queries instead of nvim-treesitter due to incompatible #lua-match? predicates
268
- // "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/highlights.scm
269
- "https://raw.githubusercontent.com/alex-pinkus/tree-sitter-swift/main/queries/highlights.scm",
270
- ],
271
- locals: [
272
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/swift/locals.scm",
273
- ],
274
- },
275
- },
276
- {
277
- filetype: "toml",
278
- wasm: "https://github.com/tree-sitter-grammars/tree-sitter-toml/releases/download/v0.7.0/tree-sitter-toml.wasm",
279
- queries: {
280
- highlights: [
281
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/master/queries/toml/highlights.scm",
282
- ],
283
- },
284
- },
285
- {
286
- filetype: "nix",
287
- // TODO: Replace with official tree-sitter-nix WASM when published
288
- // See: https://github.com/nix-community/tree-sitter-nix/issues/66
289
- wasm: "https://github.com/ast-grep/ast-grep.github.io/raw/40b84530640aa83a0d34a20a2b0623d7b8e5ea97/website/public/parsers/tree-sitter-nix.wasm",
290
- queries: {
291
- highlights: [
292
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/nix/highlights.scm",
293
- ],
294
- locals: [
295
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/nix/locals.scm",
296
- ],
297
- },
298
- },
299
- {
300
- filetype: "diff",
301
- aliases: ["udiff", "patch"],
302
- wasm: "https://github.com/tree-sitter-grammars/tree-sitter-diff/releases/download/v0.1.0/tree-sitter-diff.wasm",
303
- queries: {
304
- highlights: [
305
- "https://raw.githubusercontent.com/tree-sitter-grammars/tree-sitter-diff/master/queries/highlights.scm",
306
- ],
307
- },
308
- },
309
- {
310
- filetype: "elixir",
311
- wasm: "https://github.com/elixir-lang/tree-sitter-elixir/releases/download/v0.3.5/tree-sitter-elixir.wasm",
312
- queries: {
313
- highlights: [
314
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/elixir/highlights.scm",
315
- ],
316
- locals: [
317
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/elixir/locals.scm",
318
- ],
319
- },
320
- },
321
- {
322
- filetype: "fsharp",
323
- wasm: "https://github.com/ionide/tree-sitter-fsharp/releases/download/0.3.0/tree-sitter-fsharp.wasm",
324
- queries: {
325
- highlights: [
326
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/fsharp/highlights.scm",
327
- ],
328
- },
329
- },
330
- {
331
- filetype: "r",
332
- wasm: "https://github.com/r-lib/tree-sitter-r/releases/download/v1.2.0/tree-sitter-r.wasm",
333
- queries: {
334
- highlights: [
335
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/r/highlights.scm",
336
- ],
337
- locals: [
338
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/r/locals.scm",
339
- ],
340
- },
341
- },
342
- {
343
- filetype: "make",
344
- aliases: ["makefile"],
345
- wasm: "https://github.com/tree-sitter-grammars/tree-sitter-make/releases/download/v1.1.1/tree-sitter-make.wasm",
346
- queries: {
347
- highlights: [
348
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/make/highlights.scm",
349
- ],
350
- },
351
- },
352
- {
353
- filetype: "vim",
354
- wasm: "https://github.com/tree-sitter-grammars/tree-sitter-vim/releases/download/v0.8.1/tree-sitter-vim.wasm",
355
- queries: {
356
- highlights: [
357
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/vim/highlights.scm",
358
- ],
359
- locals: [
360
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/vim/locals.scm",
361
- ],
362
- },
363
- },
364
- {
365
- filetype: "xml",
366
- wasm: "https://github.com/tree-sitter-grammars/tree-sitter-xml/releases/download/v0.7.0/tree-sitter-xml.wasm",
367
- queries: {
368
- highlights: [
369
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/xml/highlights.scm",
370
- ],
371
- locals: [
372
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/xml/locals.scm",
373
- ],
374
- },
375
- },
376
- {
377
- filetype: "agda",
378
- wasm: "https://github.com/tree-sitter/tree-sitter-agda/releases/download/v1.3.3/tree-sitter-agda.wasm",
379
- queries: {
380
- highlights: [
381
- "https://raw.githubusercontent.com/nvim-treesitter/nvim-treesitter/refs/heads/master/queries/agda/highlights.scm",
382
- ],
383
- },
384
- },
385
- ],
386
- }
1
+ export { default } from "@opencode-ai/tui/parsers-config"
package/script/build.ts CHANGED
@@ -161,7 +161,7 @@ for (const item of targets) {
161
161
  const localPath = path.resolve(dir, "node_modules/@opentui/core/parser.worker.js")
162
162
  const rootPath = path.resolve(dir, "../../node_modules/@opentui/core/parser.worker.js")
163
163
  const parserWorker = fs.realpathSync(fs.existsSync(localPath) ? localPath : rootPath)
164
- const workerPath = "./src/cli/cmd/tui/worker.ts"
164
+ const workerPath = "./src/cli/tui/worker.ts"
165
165
 
166
166
  // Use platform-specific bunfs root path based on target OS
167
167
  const bunfsRoot = item.os === "win32" ? "B:/~BUN/root/" : "/$bunfs/root/"
package/script/schema.ts CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { Config } from "@/config/config"
4
4
  import { ConfigV1 } from "@opencode-ai/core/v1/config/config"
5
+ import { TuiConfig } from "@opencode-ai/tui/config"
5
6
  import { Schema } from "effect"
6
- import { TuiInfo } from "../src/cli/cmd/tui/config/tui-schema"
7
7
 
8
8
  type JsonSchema = Record<string, unknown>
9
9
  const MODEL_REF = "https://models.dev/model-schema.json#/$defs/Model"
@@ -73,5 +73,5 @@ await Bun.write(configFile, JSON.stringify(generateEffect(ConfigV1.Info), null,
73
73
 
74
74
  if (tuiFile) {
75
75
  console.log(tuiFile)
76
- await Bun.write(tuiFile, JSON.stringify(generateEffect(TuiInfo), null, 2))
76
+ await Bun.write(tuiFile, JSON.stringify(generateEffect(TuiConfig.Info), null, 2))
77
77
  }
@@ -5,7 +5,7 @@ import * as ts from "typescript"
5
5
  const BASE_DIR = "/home/thdxr/dev/projects/anomalyco/opencode/packages/opencode"
6
6
 
7
7
  // Get entry file from command line arg or use default
8
- const ENTRY_FILE = process.argv[2] || "src/cli/cmd/tui/plugin/index.ts"
8
+ const ENTRY_FILE = process.argv[2] || "src/plugin/tui/runtime.ts"
9
9
 
10
10
  const visited = new Set<string>()
11
11
 
@@ -1,8 +1,7 @@
1
- import { cmd } from "../cmd"
1
+ import { cmd } from "./cmd"
2
2
  import { UI } from "@/cli/ui"
3
- import { win32DisableProcessedInput, win32InstallCtrlCGuard } from "./win32"
4
- import { errorMessage } from "@/util/error"
5
- import { validateSession } from "./validate-session"
3
+ import { errorMessage } from "@opencode-ai/tui/util/error"
4
+ import { validateSession } from "../tui/validate-session"
6
5
  import { ServerAuth } from "@/server/auth"
7
6
 
8
7
  export const AttachCommand = cmd({
@@ -44,49 +43,47 @@ export const AttachCommand = cmd({
44
43
  describe: "basic auth username (defaults to OPENCODE_SERVER_USERNAME or 'opencode')",
45
44
  }),
46
45
  handler: async (args) => {
47
- const { TuiConfig } = await import("@/cli/cmd/tui/config/tui")
48
- const unguard = win32InstallCtrlCGuard()
49
- try {
50
- win32DisableProcessedInput()
51
-
52
- if (args.fork && !args.continue && !args.session) {
53
- UI.error("--fork requires --continue or --session")
54
- process.exitCode = 1
55
- return
56
- }
57
-
58
- const directory = (() => {
59
- if (!args.dir) return undefined
60
- try {
61
- process.chdir(args.dir)
62
- return process.cwd()
63
- } catch {
64
- // If the directory doesn't exist locally (remote attach), pass it through.
65
- return args.dir
66
- }
67
- })()
68
- const headers = ServerAuth.headers({ password: args.password, username: args.username })
69
- const config = await TuiConfig.get()
46
+ const { TuiConfig } = await import("@/config/tui")
47
+ if (args.fork && !args.continue && !args.session) {
48
+ UI.error("--fork requires --continue or --session")
49
+ process.exitCode = 1
50
+ return
51
+ }
70
52
 
53
+ const directory = (() => {
54
+ if (!args.dir) return undefined
71
55
  try {
72
- await validateSession({
73
- url: args.url,
74
- sessionID: args.session,
75
- directory,
76
- headers,
77
- })
78
- } catch (error) {
79
- UI.error(errorMessage(error))
80
- process.exitCode = 1
81
- return
56
+ process.chdir(args.dir)
57
+ return process.cwd()
58
+ } catch {
59
+ // If the directory doesn't exist locally (remote attach), pass it through.
60
+ return args.dir
82
61
  }
62
+ })()
63
+ const headers = ServerAuth.headers({ password: args.password, username: args.username })
64
+ const config = await TuiConfig.get()
65
+
66
+ try {
67
+ await validateSession({
68
+ url: args.url,
69
+ sessionID: args.session,
70
+ directory,
71
+ headers,
72
+ })
73
+ } catch (error) {
74
+ UI.error(errorMessage(error))
75
+ process.exitCode = 1
76
+ return
77
+ }
83
78
 
84
- const { createTuiRenderer, tui } = await import("./app")
85
- const renderer = await createTuiRenderer(config)
86
- const handle = tui({
79
+ const { Effect } = await import("effect")
80
+ const { run } = await import("../tui/layer")
81
+ const { createLegacyTuiPluginHost } = await import("@/plugin/tui/runtime")
82
+ await Effect.runPromise(
83
+ run({
87
84
  url: args.url,
88
85
  config,
89
- renderer,
86
+ pluginHost: createLegacyTuiPluginHost(),
90
87
  args: {
91
88
  continue: args.continue,
92
89
  sessionID: args.session,
@@ -94,10 +91,7 @@ export const AttachCommand = cmd({
94
91
  },
95
92
  directory,
96
93
  headers,
97
- })
98
- await handle.done
99
- } finally {
100
- unguard?.()
101
- }
94
+ }),
95
+ )
102
96
  },
103
97
  })
@@ -1,48 +1 @@
1
- const graphemes = new Intl.Segmenter(undefined, { granularity: "grapheme" })
2
-
3
- export function promptOffsetWidth(value: string) {
4
- let width = 0
5
- for (const part of graphemes.segment(value)) {
6
- // Textarea offsets count newlines as one position; Bun.stringWidth counts them as zero.
7
- width += part.segment === "\n" ? 1 : Bun.stringWidth(part.segment)
8
- }
9
- return width
10
- }
11
-
12
- function displayOffsetIndex(value: string, offset: number) {
13
- if (offset <= 0) return 0
14
-
15
- let width = 0
16
- for (const part of graphemes.segment(value)) {
17
- const next = width + promptOffsetWidth(part.segment)
18
- if (next > offset) return part.index
19
- width = next
20
- }
21
-
22
- return value.length
23
- }
24
-
25
- export function displaySlice(value: string, start = 0, end = promptOffsetWidth(value)) {
26
- return value.slice(displayOffsetIndex(value, start), displayOffsetIndex(value, end))
27
- }
28
-
29
- export function displayCharAt(value: string, offset: number) {
30
- let width = 0
31
- for (const part of graphemes.segment(value)) {
32
- const next = width + promptOffsetWidth(part.segment)
33
- if (offset === width || offset < next) return part.segment
34
- width = next
35
- }
36
- }
37
-
38
- export function mentionTriggerIndex(value: string, offset = promptOffsetWidth(value)) {
39
- const text = displaySlice(value, 0, offset)
40
- const index = text.lastIndexOf("@")
41
- if (index === -1) return
42
-
43
- const before = index === 0 ? undefined : text[index - 1]
44
- const query = text.slice(index)
45
- if ((before === undefined || /\s/.test(before)) && !/\s/.test(query)) {
46
- return promptOffsetWidth(text.slice(0, index))
47
- }
48
- }
1
+ export * from "@opencode-ai/tui/prompt/display"
@@ -181,7 +181,7 @@ function showSubagent(
181
181
  callID: string
182
182
  label: string
183
183
  description: string
184
- status: "running" | "completed" | "error"
184
+ status: "running" | "completed" | "cancelled" | "error"
185
185
  title?: string
186
186
  toolCalls?: number
187
187
  commits: StreamCommit[]
@@ -79,6 +79,13 @@ function systemBody(raw: string, phase: StreamCommit["phase"]): RunEntryBody {
79
79
  }
80
80
 
81
81
  export function entryFlags(commit: StreamCommit): EntryFlags {
82
+ if (commit.summary) {
83
+ return {
84
+ startOnNewLine: true,
85
+ trailingNewline: false,
86
+ }
87
+ }
88
+
82
89
  if (commit.kind === "user") {
83
90
  return {
84
91
  startOnNewLine: true,
@@ -156,6 +163,10 @@ export function entryCanStream(commit: StreamCommit, body: RunEntryBody): boolea
156
163
  }
157
164
 
158
165
  export function entryBody(commit: StreamCommit): RunEntryBody {
166
+ if (commit.summary) {
167
+ return RUN_ENTRY_NONE
168
+ }
169
+
159
170
  const raw = cleanRunText(commit.text)
160
171
 
161
172
  if (commit.kind === "user") {