@khalilgharbaoui/opencode-claude-code-plugin 0.4.15 → 0.4.16

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/dist/index.js CHANGED
@@ -1594,6 +1594,12 @@ function shouldAutoContinueIncompleteTurn(state, snapshot) {
1594
1594
  if (state.enabled === false) return { continue: false, reason: "disabled" };
1595
1595
  if (snapshot.isError) return { continue: false, reason: "error" };
1596
1596
  if (state.aborted) return { continue: false, reason: "aborted" };
1597
+ if (snapshot.stopReason) {
1598
+ return {
1599
+ continue: false,
1600
+ reason: snapshot.stopReason.replace(/_/g, "-")
1601
+ };
1602
+ }
1597
1603
  if (state.attempts >= AUTO_CONTINUE_MAX_ATTEMPTS) {
1598
1604
  return { continue: false, reason: "max-attempts" };
1599
1605
  }
@@ -2571,6 +2577,7 @@ ${plan}
2571
2577
  let hadReasoningSinceContinue = false;
2572
2578
  let hadToolActivitySinceContinue = false;
2573
2579
  let hadProxyActivitySinceContinue = false;
2580
+ let lastStopReason = null;
2574
2581
  const autoContinueState = {
2575
2582
  enabled: self.config.autoContinueIncompleteTurns,
2576
2583
  attempts: 0,
@@ -2671,6 +2678,7 @@ ${plan}
2671
2678
  hadReasoningSinceContinue = false;
2672
2679
  hadToolActivitySinceContinue = false;
2673
2680
  hadProxyActivitySinceContinue = false;
2681
+ lastStopReason = null;
2674
2682
  };
2675
2683
  let gotPartialEvents = false;
2676
2684
  const lineHandler = (line) => {
@@ -2880,6 +2888,12 @@ ${plan}
2880
2888
  }
2881
2889
  }
2882
2890
  }
2891
+ if (gotPartialEvents && msg.type === "message_delta" && typeof msg.delta?.stop_reason === "string") {
2892
+ lastStopReason = msg.delta.stop_reason;
2893
+ }
2894
+ if (msg.type === "assistant" && msg.message && typeof msg.message.stop_reason === "string") {
2895
+ lastStopReason = msg.message.stop_reason;
2896
+ }
2883
2897
  if (msg.type === "assistant" && msg.message?.content && !gotPartialEvents) {
2884
2898
  const hasText = msg.message.content.some(
2885
2899
  (b) => b.type === "text" && b.text
@@ -3113,7 +3127,8 @@ ${plan}
3113
3127
  hadReasoning: hadReasoningSinceContinue,
3114
3128
  hadToolActivity: hadToolActivitySinceContinue,
3115
3129
  hadProxyActivity: hadProxyActivitySinceContinue,
3116
- isError: msg.is_error
3130
+ isError: msg.is_error,
3131
+ stopReason: lastStopReason
3117
3132
  }
3118
3133
  );
3119
3134
  if (autoDecision.continue) {
@@ -3146,6 +3161,7 @@ ${plan}
3146
3161
  log.notice("auto-continuation stopped", {
3147
3162
  sessionKey: sk,
3148
3163
  reason: autoDecision.reason,
3164
+ stopReason: lastStopReason,
3149
3165
  attempts: autoContinueState.attempts,
3150
3166
  textLength: visibleTextSinceContinue.length,
3151
3167
  lastTextLength: lastVisibleTextSinceContinue.length,