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.
- package/dist/service/a2a-adapter.js +23 -8
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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
|
-
//
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
-
|
|
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) {
|