@khalilgharbaoui/opencode-claude-code-plugin 0.53.1 → 0.53.2

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
@@ -4044,7 +4044,13 @@ var TASK_INPUT_PROPERTIES = {
4044
4044
  },
4045
4045
  background: {
4046
4046
  type: "boolean",
4047
- description: 'Run the subagent in the background and return immediately with a `<task id="..." state="running">` envelope instead of its answer. You are notified automatically when it completes. Do NOT sleep, poll or proactively check on its progress.'
4047
+ // Both majors, for the reason the `task_id` field names both: a model
4048
+ // told to look for only V1's envelope finds nothing on opencode 2, where
4049
+ // a background dispatch answers in prose, and then has no task_id to pass
4050
+ // to task_status or task_cancel. This constant is shared by `task` and by
4051
+ // every `task_batch` item and is built with no dialect in hand, so it
4052
+ // names both rather than being rewritten per host.
4053
+ description: 'Run the subagent in the background and return immediately instead of its answer: opencode 1.x answers with a `<task id="..." state="running">` envelope, opencode 2 with `The subagent is working in the background (sessionID: ses_...)`. You are notified automatically when it completes. Do NOT sleep, poll or proactively check on its progress.'
4048
4054
  }
4049
4055
  };
4050
4056
  var TASK_INPUT_PROPERTIES_NO_BACKGROUND = Object.fromEntries(
@@ -12120,6 +12126,17 @@ This opencode host runs background subagents, so \`mcp__opencode_proxy__task\` t
12120
12126
  - After starting one, keep working on something that does not overlap it, then end your turn normally. When the subagent finishes, opencode delivers its result into this conversation as a new message on its own. Do not sleep, poll, or ask the operator to wait.
12121
12127
  - The \`id\` in that envelope is the task_id. \`mcp__opencode_proxy__task_status\` reads a result back if the automatic delivery did not arrive (an interrupted or errored turn); \`mcp__opencode_proxy__task_cancel\` stops a background subagent you no longer want. Neither is a progress poll.
12122
12128
  - Foreground is still the default and still the right choice when you need the answer before you can continue. Use background only for work that genuinely runs alongside yours.`;
12129
+ var BACKGROUND_SUBAGENT_HINT_V2 = `## Background subagents
12130
+
12131
+ This opencode host runs background subagents, so \`mcp__opencode_proxy__task\` takes \`background: true\`.
12132
+
12133
+ - A background dispatch returns at once with \`The subagent is working in the background (sessionID: ses_...)\` instead of the subagent's answer. That is success, not a truncated result.
12134
+ - After starting one, keep working on something that does not overlap it, then end your turn normally. When the subagent finishes, opencode delivers its result into this conversation on its own, as a \`<subagent sessionID="..." state="completed">\` message. Do not sleep, poll, or ask the operator to wait.
12135
+ - That \`sessionID\` is the task_id. \`mcp__opencode_proxy__task_status\` reads a result back if the automatic delivery did not arrive (an interrupted or errored turn); \`mcp__opencode_proxy__task_cancel\` stops a background subagent you no longer want. Neither is a progress poll.
12136
+ - Foreground is still the default and still the right choice when you need the answer before you can continue. Use background only for work that genuinely runs alongside yours.`;
12137
+ function backgroundSubagentHint(dialect) {
12138
+ return dialect === "v2" ? BACKGROUND_SUBAGENT_HINT_V2 : BACKGROUND_SUBAGENT_HINT;
12139
+ }
12123
12140
  var QUESTION_PROXY_HINT = `## Asking the operator questions
12124
12141
 
12125
12142
  Structured questions in this environment go through exactly one tool: \`mcp__opencode_proxy__question\`.
@@ -16005,6 +16022,7 @@ var ClaudeCodeLanguageModel = class {
16005
16022
  };
16006
16023
  let enrichedProxy = resolvedProxy;
16007
16024
  let backgroundSubagentsSupported = false;
16025
+ const hostDialect = self.config.hostApi === "v2" ? "v2" : "v1";
16008
16026
  if (enrichedProxy && taskProxyEnabled) {
16009
16027
  enrichedProxy = overlayTaskProxyDescription(
16010
16028
  enrichedProxy,
@@ -16019,7 +16037,6 @@ var ClaudeCodeLanguageModel = class {
16019
16037
  )
16020
16038
  )
16021
16039
  });
16022
- const hostDialect = self.config.hostApi === "v2" ? "v2" : "v1";
16023
16040
  backgroundSubagentsSupported = liveTaskSupportsBackground(
16024
16041
  liveToolInfo.taskParameters,
16025
16042
  hostDialect
@@ -16096,6 +16113,7 @@ var ClaudeCodeLanguageModel = class {
16096
16113
  excludeServers,
16097
16114
  taskProxyEnabled,
16098
16115
  backgroundSubagentsSupported,
16116
+ hostDialect,
16099
16117
  questionProxyActive,
16100
16118
  opencodeToolDefs,
16101
16119
  pluginCompressEnabled,
@@ -16161,7 +16179,7 @@ var ClaudeCodeLanguageModel = class {
16161
16179
  // dispatch instead of calling the proxy (h #g74).
16162
16180
  [
16163
16181
  ...wiring.taskProxyEnabled ? [SUBAGENT_DISPATCH_HINT] : [],
16164
- ...wiring.backgroundSubagentsSupported ? [BACKGROUND_SUBAGENT_HINT] : [],
16182
+ ...wiring.backgroundSubagentsSupported ? [backgroundSubagentHint(wiring.hostDialect)] : [],
16165
16183
  ...wiring.questionProxyActive ? [QUESTION_PROXY_HINT] : []
16166
16184
  ],
16167
16185
  {
@@ -16275,6 +16293,7 @@ var ClaudeCodeLanguageModel = class {
16275
16293
  excludeServers,
16276
16294
  taskProxyEnabled,
16277
16295
  backgroundSubagentsSupported,
16296
+ hostDialect,
16278
16297
  questionProxyActive,
16279
16298
  opencodeToolDefs,
16280
16299
  pluginCompressEnabled,
@@ -16292,7 +16311,7 @@ var ClaudeCodeLanguageModel = class {
16292
16311
  [
16293
16312
  ...extractSystemMessages(options.prompt),
16294
16313
  ...taskProxyEnabled ? [SUBAGENT_DISPATCH_HINT] : [],
16295
- ...backgroundSubagentsSupported ? [BACKGROUND_SUBAGENT_HINT] : [],
16314
+ ...backgroundSubagentsSupported ? [backgroundSubagentHint(hostDialect)] : [],
16296
16315
  ...questionProxyActive ? [QUESTION_PROXY_HINT] : [],
16297
16316
  ...self.config.hostApi === "v2" && options.tools?.some((t) => t.name === "execute") ? [codeModeProxyHint(opencodeToolDefs.some((t) => t.name === "execute"))] : []
16298
16317
  ],