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 -6
View File
@@ -5,11 +5,11 @@
"dismiss_error": "Dismiss",
"empty": "No messages yet. Send a prompt to begin.",
"open_terminal": "Open in terminal",
"placeholder": "Ask OpenCode anything… (Enter = newline, Ctrl+Enter = send)",
"placeholder": "Ask OpenCode anything… (Enter = send, Shift+Enter = new line)",
"refresh": "Refresh",
"select_agent": "Agent",
"select_model": "Model",
"send": "Send (Ctrl+Enter)",
"send": "Send (Enter)",
"stop": "Stop",
"thinking": "Thinking…",
"title": "OpenCode Chat",
@@ -106,10 +106,6 @@
"description": "Messages loaded per session (1–100). Set the slider to its top notch for unlimited. Default: 50.",
"label": "Max Messages to Load"
},
"notify_on_complete": {
"description": "Show a desktop notification when a response completes.",
"label": "Notify on Completion"
},
"panel_mode": {
"description": "Fill right opens a full-height panel pinned to the right edge; Compact shows the original floating panel near the bar click.",
"label": "Panel Layout",