feat(plugin): OpenCode Companion beta.8 upgrade + streaming/overflow (#337)

* feat(plugin): OpenCode Companion beta.8 upgrade + streaming/overflow
fixes

Upgrade to plugin API 21 and reverse the chat so the newest message sits
at the bottom with auto-scroll:

- panel: reverse message list to oldest-first; pin the scroll to the
  bottom via stickToBottom, jump there on open and session switch via
  scrollToBottomRev, and clear the stick flag in onScroll when the user
  scrolls away so reading history doesn't yank them down.
- composer: enable submitOnEnter so Enter sends and Shift+Enter inserts
  a
  newline; update en/vi placeholder and send-tooltip strings.
- panel: render assistant replies as markdown (headings, lists, tables),
  keeping user messages as plain labels.

Fix runtime errors surfaced during use:

- panel: pin markdown width to WRAP — ui.markdown has no maxWidth prop,
  so
  a bare flexGrow left it unconstrained and single-line text overflowed.
- panel: wrap fenced code blocks in monospace labels with a maxWidth —
  noctalia's MarkdownView never wraps code, so long bash/code lines
  spilled outside the panel. Text outside code fences stays markdown.
- panel: coerce onScroll(offset, maxOffset) args with tonumber — the
  reconciler passes them as strings, raising "attempt to compare number
  <= string".
- service: handle message.part.updated / message.updated streaming via
  throttled reload; acknowledge message.part.delta without reloading
  (the
  server emits one per token, and reloading on each decodes the whole
  history and blows the async callback CPU budget in json.decode).
- service: handle session.updated / session.diff with a throttled
  session
  reload so auto-generated titles stay current in the chooser.

Verified with luac syntax checks and a standalone split_markdown test
(5 cases) and JSON validation of the translation files.

* update version to 0.2.0
This commit is contained in:
weinguyen
2026-08-12 09:49:13 -04:00
committed by GitHub
parent 6fcf69f738
commit 27458632e2
6 changed files with 210 additions and 95 deletions
+2 -7
View File
@@ -5,11 +5,11 @@
"dismiss_error": "Bỏ qua",
"empty": "Chưa có tin nhắn. Gửi prompt để bắt đầu.",
"open_terminal": "Mở trong terminal",
"placeholder": "Hỏi OpenCode bất cứ điều gì… (Enter = xuống dòng, Ctrl+Enter = gửi)",
"placeholder": "Hỏi OpenCode bất cứ điều gì… (Enter = Gửi, Shift+Enter = xuống dòng)",
"refresh": "Làm mới",
"select_agent": "Agent",
"select_model": "Mô hình",
"send": "Gửi (Ctrl+Enter)",
"send": "Gửi (Enter)",
"stop": "Dừng",
"thinking": "Đang suy nghĩ…",
"title": "OpenCode Chat",
@@ -86,7 +86,6 @@
"label": "Agent mặc định"
},
"default_model": {
"description": "Model mặc định theo định dạng 'provider/model' (ví dụ: 'anthropic/claude-3-5-sonnet-20241022'). Để trống để dùng mặc định của máy chủ.",
"label": "Model mặc định"
},
"default_workspace": {
@@ -106,10 +105,6 @@
"description": "Số tin nhắn tải mỗi phiên (1–100). Kéo thanh trượt lên mức cao nhất để không giới hạn. Mặc định: 50.",
"label": "Số tin nhắn tải tối đa"
},
"notify_on_complete": {
"description": "Hiển thị thông báo trên desktop khi phản hồi hoàn tất.",
"label": "Thông báo khi hoàn tất"
},
"panel_mode": {
"description": "Full-height sát phải mở panel cao trọn màn hình ghim vào mép phải; Compact hiển thị panel nổi gần chỗ bấm trên thanh bar.",
"label": "Kiểu panel",