opencode-gateway 0.3.0 → 0.3.1

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 (2) hide show
  1. package/dist/index.js +8 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -18231,18 +18231,24 @@ function listAssistantResponses(messages, userMessageId) {
18231
18231
  function selectAssistantResponse(assistantChildren) {
18232
18232
  for (let index = assistantChildren.length - 1;index >= 0; index -= 1) {
18233
18233
  const candidate = assistantChildren[index];
18234
- if (hasVisibleText(candidate)) {
18234
+ if (isTerminalAssistantMessage(candidate) && hasVisibleText(candidate)) {
18235
18235
  return candidate;
18236
18236
  }
18237
18237
  }
18238
18238
  for (let index = assistantChildren.length - 1;index >= 0; index -= 1) {
18239
18239
  const candidate = assistantChildren[index];
18240
- if (candidate.info?.finish === "stop" || candidate.info?.error !== undefined) {
18240
+ if (isTerminalAssistantMessage(candidate)) {
18241
18241
  return candidate;
18242
18242
  }
18243
18243
  }
18244
18244
  return null;
18245
18245
  }
18246
+ function isTerminalAssistantMessage(message) {
18247
+ if (message.info.error !== undefined) {
18248
+ return true;
18249
+ }
18250
+ return typeof message.info.finish === "string" && message.info.finish !== "tool-calls";
18251
+ }
18246
18252
  function createAssistantProgressKey(messages) {
18247
18253
  return JSON.stringify(messages.map(createAssistantCandidateKey));
18248
18254
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-gateway",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Gateway plugin for OpenCode",
5
5
  "license": "MIT",
6
6
  "type": "module",