multiclaws 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/infra/frp.js
CHANGED
|
@@ -362,8 +362,9 @@ class FrpTunnelManager {
|
|
|
362
362
|
(0, node_child_process_1.execSync)(`tar -xzf "${archivePath}" -C "${downloadDir}"`, { stdio: "ignore" });
|
|
363
363
|
}
|
|
364
364
|
else {
|
|
365
|
-
// Windows:
|
|
366
|
-
|
|
365
|
+
// Windows: suppress progress bar to prevent silent failure in headless environments;
|
|
366
|
+
// use stdio:"pipe" so execSync captures errors if PowerShell exits non-zero
|
|
367
|
+
(0, node_child_process_1.execSync)(`powershell -NoProfile -Command "$ProgressPreference = 'SilentlyContinue'; Expand-Archive -LiteralPath '${archivePath}' -DestinationPath '${downloadDir}' -Force"`, { stdio: "pipe" });
|
|
367
368
|
}
|
|
368
369
|
// Move binary to target
|
|
369
370
|
const extractedBinary = node_path_1.default.join(downloadDir, archiveName, binaryName);
|
|
@@ -27,17 +27,20 @@ export declare class OpenClawAgentExecutor implements AgentExecutor {
|
|
|
27
27
|
constructor(options: A2AAdapterOptions);
|
|
28
28
|
execute(context: RequestContext, eventBus: ExecutionEventBus): Promise<void>;
|
|
29
29
|
/**
|
|
30
|
-
* Poll sessions_history until the subagent
|
|
31
|
-
*
|
|
30
|
+
* Poll sessions_history until the subagent session completes.
|
|
31
|
+
* Collects ALL assistant text messages and returns them joined.
|
|
32
32
|
*/
|
|
33
33
|
private waitForCompletion;
|
|
34
34
|
/**
|
|
35
|
-
* Extract
|
|
35
|
+
* Extract all assistant text from session history once the session is complete.
|
|
36
36
|
* Returns null if the session is still running.
|
|
37
|
+
* Returns all assistant text messages joined (not just the last one).
|
|
37
38
|
*
|
|
38
39
|
* Gateway /tools/invoke returns: { content: [...], details: { messages: [...], isComplete?: boolean } }
|
|
39
40
|
*/
|
|
40
41
|
private extractCompletedResult;
|
|
42
|
+
/** Extract text content from a single history message. */
|
|
43
|
+
private extractTextFromHistoryMessage;
|
|
41
44
|
cancelTask(taskId: string, eventBus: ExecutionEventBus): Promise<void>;
|
|
42
45
|
updateGatewayConfig(config: GatewayConfig): void;
|
|
43
46
|
private publishMessage;
|
|
@@ -103,14 +103,13 @@ class OpenClawAgentExecutor {
|
|
|
103
103
|
eventBus.finished();
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
|
-
* Poll sessions_history until the subagent
|
|
107
|
-
*
|
|
106
|
+
* Poll sessions_history until the subagent session completes.
|
|
107
|
+
* Collects ALL assistant text messages and returns them joined.
|
|
108
108
|
*/
|
|
109
109
|
async waitForCompletion(sessionKey, timeoutMs) {
|
|
110
110
|
const gateway = this.gatewayConfig;
|
|
111
111
|
const startTime = Date.now();
|
|
112
112
|
let attempt = 0;
|
|
113
|
-
// Start aggressive, max out at 500ms to minimize result latency
|
|
114
113
|
const pollDelays = [100, 200, 300, 500];
|
|
115
114
|
while (Date.now() - startTime < timeoutMs) {
|
|
116
115
|
const delay = pollDelays[Math.min(attempt, pollDelays.length - 1)];
|
|
@@ -122,7 +121,7 @@ class OpenClawAgentExecutor {
|
|
|
122
121
|
tool: "sessions_history",
|
|
123
122
|
args: {
|
|
124
123
|
sessionKey,
|
|
125
|
-
limit:
|
|
124
|
+
limit: 50,
|
|
126
125
|
includeTools: false,
|
|
127
126
|
},
|
|
128
127
|
timeoutMs: 8_000,
|
|
@@ -140,8 +139,9 @@ class OpenClawAgentExecutor {
|
|
|
140
139
|
throw new Error(`task timed out after ${Math.round(timeoutMs / 1000)}s waiting for subagent`);
|
|
141
140
|
}
|
|
142
141
|
/**
|
|
143
|
-
* Extract
|
|
142
|
+
* Extract all assistant text from session history once the session is complete.
|
|
144
143
|
* Returns null if the session is still running.
|
|
144
|
+
* Returns all assistant text messages joined (not just the last one).
|
|
145
145
|
*
|
|
146
146
|
* Gateway /tools/invoke returns: { content: [...], details: { messages: [...], isComplete?: boolean } }
|
|
147
147
|
*/
|
|
@@ -155,34 +155,51 @@ class OpenClawAgentExecutor {
|
|
|
155
155
|
const messages = (details.messages ?? []);
|
|
156
156
|
if (messages.length === 0)
|
|
157
157
|
return null;
|
|
158
|
-
// If no explicit flag,
|
|
158
|
+
// If no explicit isComplete flag, use heuristic: check if the session is still executing
|
|
159
159
|
if (details.isComplete === undefined) {
|
|
160
160
|
const lastMsg = messages[messages.length - 1];
|
|
161
161
|
if (lastMsg && Array.isArray(lastMsg.content)) {
|
|
162
162
|
const content = lastMsg.content;
|
|
163
163
|
const hasToolCalls = content.some((c) => c?.type === "toolCall" || c?.type === "tool_use");
|
|
164
|
+
// If the last message only has tool calls (no text), still running
|
|
164
165
|
const hasText = content.some((c) => c?.type === "text" && typeof c.text === "string" && c.text.trim());
|
|
165
166
|
if (hasToolCalls && !hasText)
|
|
166
167
|
return null;
|
|
167
168
|
}
|
|
169
|
+
// 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")
|
|
172
|
+
return null;
|
|
168
173
|
}
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
|
|
174
|
+
// Session is complete — collect ALL assistant text messages in order
|
|
175
|
+
const allTexts = [];
|
|
176
|
+
for (const msg of messages) {
|
|
172
177
|
if (msg.role !== "assistant")
|
|
173
178
|
continue;
|
|
174
|
-
const
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
179
|
+
const text = this.extractTextFromHistoryMessage(msg);
|
|
180
|
+
if (text)
|
|
181
|
+
allTexts.push(text);
|
|
182
|
+
}
|
|
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
|
+
}
|
|
188
|
+
return allTexts.join("\n\n");
|
|
189
|
+
}
|
|
190
|
+
/** Extract text content from a single history message. */
|
|
191
|
+
extractTextFromHistoryMessage(msg) {
|
|
192
|
+
const content = msg.content;
|
|
193
|
+
if (typeof content === "string" && content.trim()) {
|
|
194
|
+
return content;
|
|
195
|
+
}
|
|
196
|
+
if (Array.isArray(content)) {
|
|
197
|
+
const parts = content;
|
|
198
|
+
const textParts = parts
|
|
199
|
+
.filter((c) => c?.type === "text" && typeof c.text === "string" && c.text.trim())
|
|
200
|
+
.map((c) => c.text);
|
|
201
|
+
if (textParts.length > 0) {
|
|
202
|
+
return textParts.join("\n");
|
|
186
203
|
}
|
|
187
204
|
}
|
|
188
205
|
return null;
|