multiclaws 0.4.16 → 0.4.17

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.
@@ -152,11 +152,16 @@ class OpenClawAgentExecutor {
152
152
  // Respect explicit completion flag from gateway
153
153
  if (details.isComplete === false)
154
154
  return null;
155
+ // Check for session-level error/status from gateway
156
+ const sessionError = details.error;
157
+ const sessionStatus = details.status;
155
158
  const messages = (details.messages ?? []);
156
- if (messages.length === 0)
159
+ if (messages.length === 0 && !details.isComplete)
157
160
  return null;
158
161
  // If no explicit isComplete flag, use heuristic: check if the session is still executing
159
162
  if (details.isComplete === undefined) {
163
+ if (messages.length === 0)
164
+ return null;
160
165
  const lastMsg = messages[messages.length - 1];
161
166
  if (lastMsg && Array.isArray(lastMsg.content)) {
162
167
  const content = lastMsg.content;
@@ -167,8 +172,7 @@ class OpenClawAgentExecutor {
167
172
  return null;
168
173
  }
169
174
  // If the last message is a user message, the agent hasn't responded yet
170
- const lastMsg2 = messages[messages.length - 1];
171
- if (lastMsg2?.role === "user")
175
+ if (lastMsg?.role === "user")
172
176
  return null;
173
177
  }
174
178
  // Session is complete — collect ALL assistant text messages in order
@@ -180,12 +184,23 @@ class OpenClawAgentExecutor {
180
184
  if (text)
181
185
  allTexts.push(text);
182
186
  }
183
- // Session completed but no text output return a marker instead of null
184
- // to avoid infinite polling / timeout
185
- if (allTexts.length === 0) {
186
- return "(task completed with no text output)";
187
+ // If we have assistant text, return it (even if there's also an error)
188
+ if (allTexts.length > 0) {
189
+ // Append error info if present so the delegating agent sees both
190
+ if (sessionError) {
191
+ allTexts.push(`[session error: ${sessionError}]`);
192
+ }
193
+ return allTexts.join("\n\n");
194
+ }
195
+ // No assistant text — check if the session reported an error
196
+ if (sessionError) {
197
+ return `Error: ${sessionError}`;
198
+ }
199
+ if (sessionStatus === "failed" || sessionStatus === "error") {
200
+ return `Error: session ended with status "${sessionStatus}"`;
187
201
  }
188
- return allTexts.join("\n\n");
202
+ // Session truly completed with no output at all
203
+ return "(task completed with no text output)";
189
204
  }
190
205
  /** Extract text content from a single history message. */
191
206
  extractTextFromHistoryMessage(msg) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "multiclaws",
3
- "version": "0.4.16",
3
+ "version": "0.4.17",
4
4
  "description": "MultiClaws plugin for OpenClaw collaboration via A2A protocol",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",