@peakflo/agent-harness 0.2.5 → 0.2.6-rc.1
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.
|
@@ -156,7 +156,11 @@ function buildPiMcpConfigDocument(servers, onRename) {
|
|
|
156
156
|
slug,
|
|
157
157
|
{
|
|
158
158
|
url: server.url,
|
|
159
|
-
headers: server.headers ?? {}
|
|
159
|
+
headers: server.headers ?? {},
|
|
160
|
+
// The managed integrations gateway can wait for a cold pfMCP
|
|
161
|
+
// instance. Its own upstream deadline is 270 seconds, so Pi must
|
|
162
|
+
// wait long enough to receive the gateway's result or clear error.
|
|
163
|
+
...(name === 'integrations' ? { requestTimeoutMs: 300_000 } : {})
|
|
160
164
|
}
|
|
161
165
|
];
|
|
162
166
|
}));
|
|
@@ -201,12 +201,16 @@ class McpAuthProxy {
|
|
|
201
201
|
}
|
|
202
202
|
catch (error) {
|
|
203
203
|
this.reportTokenFailure(id, target.label, error);
|
|
204
|
+
if (res.destroyed)
|
|
205
|
+
return;
|
|
204
206
|
res.writeHead(502, { 'Content-Type': 'application/json' });
|
|
205
207
|
res.end(JSON.stringify({
|
|
206
208
|
error: `Failed to obtain auth token for "${target.label}"`
|
|
207
209
|
}));
|
|
208
210
|
return;
|
|
209
211
|
}
|
|
212
|
+
if (res.destroyed)
|
|
213
|
+
return;
|
|
210
214
|
const forwardHeaders = {};
|
|
211
215
|
for (const [key, value] of Object.entries(req.headers)) {
|
|
212
216
|
const lower = key.toLowerCase();
|
|
@@ -252,6 +256,8 @@ class McpAuthProxy {
|
|
|
252
256
|
}
|
|
253
257
|
});
|
|
254
258
|
proxyReq.on('error', (error) => {
|
|
259
|
+
if (res.destroyed)
|
|
260
|
+
return;
|
|
255
261
|
this.logger.error(`[McpAuthProxy] Upstream error for "${target.label}": ${error.message}`);
|
|
256
262
|
if (!res.headersSent) {
|
|
257
263
|
res.writeHead(502, { 'Content-Type': 'application/json' });
|
|
@@ -261,6 +267,17 @@ class McpAuthProxy {
|
|
|
261
267
|
res.end();
|
|
262
268
|
}
|
|
263
269
|
});
|
|
270
|
+
// The agent can stop waiting before the gateway answers. Close that
|
|
271
|
+
// upstream request so the gateway can abort its own pfMCP discovery.
|
|
272
|
+
const stopForwarding = () => {
|
|
273
|
+
if (!res.writableEnded)
|
|
274
|
+
proxyReq.destroy();
|
|
275
|
+
};
|
|
276
|
+
res.once('close', stopForwarding);
|
|
277
|
+
if (res.destroyed) {
|
|
278
|
+
stopForwarding();
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
264
281
|
req.pipe(proxyReq);
|
|
265
282
|
}
|
|
266
283
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peakflo/agent-harness",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6-rc.1",
|
|
4
4
|
"description": "Headless Peakflo coding-agent harness. One codebase, three hosting modes: a Daytona cloud sandbox, a customer VM, and the 20x desktop.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|