@nxxxsooo/opencode-annotate 0.10.3 → 0.10.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.4 — interrupted replies
4
+
5
+ - Let `/annotate`, `/annotate-pick` and `/ref` use the text of an interrupted reply, such
6
+ as one stopped while its questions were waiting for an answer. Previously `/annotate`
7
+ reported that the session had no completed reply.
8
+
3
9
  ## 0.10.3 — long code lines and compose cursor
4
10
 
5
11
  - Wrap long lines in code blocks at the edge of the view instead of cutting them off, so
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxxxsooo/opencode-annotate",
3
- "version": "0.10.3",
3
+ "version": "0.10.4",
4
4
  "description": "Unofficial OpenCode plugin: annotate replies, documents and webpages, and reference previous conversations.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/review.mjs CHANGED
@@ -9,6 +9,7 @@ import { wantsBrowser } from "./targets.mjs"
9
9
  import { prepareTheme } from "./theme.mjs"
10
10
  import { createInputSource } from "./input-source.mjs"
11
11
  import { resolveTuiBinary } from "./tui/binary.mjs"
12
+ import { finishedAssistant } from "./session-reference.mjs"
12
13
 
13
14
  const execute = promisify(execFile)
14
15
  const documentExtensions = new Set([".md", ".mdx", ".markdown", ".txt"])
@@ -64,8 +65,7 @@ function textMessages(messages) {
64
65
  b.time.created - a.time.created || b.id.localeCompare(a.id),
65
66
  )
66
67
  for (const message of newest) {
67
- if (message.type !== "assistant" || message.time.completed === undefined || message.error) continue
68
- if (["error", "content-filter"].includes(message.finish)) continue
68
+ if (!finishedAssistant(message) || message.finish === "content-filter") continue
69
69
  const text = message.content.filter(part => part.type === "text").map(part => part.text).join("\n\n")
70
70
  if (text.trim()) {
71
71
  texts.push({ id: message.id, text, progress: message.finish === "tool-calls", created: message.time.created })
@@ -29,9 +29,17 @@ export async function searchSessions(client, current, { query = "", allProjects
29
29
  }
30
30
  }
31
31
 
32
+ // An interrupted turn ends with finish "error" and an "aborted" error, yet keeps the text
33
+ // it already streamed, which the transcript still shows.
34
+ export function finishedAssistant(message) {
35
+ if (message.type !== "assistant" || message.time.completed === undefined) return false
36
+ if (message.error?.type === "aborted") return true
37
+ return !message.error && message.finish !== "error"
38
+ }
39
+
32
40
  function messageText(message) {
33
41
  if (message.type === "user") return message.text
34
- if (message.type !== "assistant" || message.time.completed === undefined || message.error || message.finish === "error") return ""
42
+ if (!finishedAssistant(message)) return ""
35
43
  return message.content.filter(part => part.type === "text").map(part => part.text).join("\n\n")
36
44
  }
37
45
 
Binary file
Binary file
Binary file
Binary file
Binary file