palz-connector 1.7.2 → 1.7.4
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/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/palz-connector.config.json +2 -2
- package/palz-connector.dev.config.json +2 -2
- package/palz-connector.global.dev.config.json +2 -2
- package/palz-connector.global.prod.config.json +2 -2
- package/palz-connector.global.staging.config.json +2 -2
- package/palz-connector.prod.config.json +2 -2
- package/palz-connector.staging.config.json +2 -2
- package/src/gateway-relay.js +11 -6
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"enabled": true,
|
|
3
|
-
"streamUrl": "ws://14.103.148.99:8090/ws/bot",
|
|
4
|
-
"apiBaseUrl": "http://14.103.148.99:8090/api",
|
|
3
|
+
"streamUrl": "ws://14.103.148.99:8090/im-server/ws/bot",
|
|
4
|
+
"apiBaseUrl": "http://14.103.148.99:8090/im-server/api",
|
|
5
5
|
"clawGatewayUrl": "http://claw-gateway:8080",
|
|
6
6
|
"activityReportEnabled": false,
|
|
7
7
|
"sessionTimeout": 1800000,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"enabled": true,
|
|
3
|
-
"streamUrl": "ws://claw-server:8787/ws/bot",
|
|
4
|
-
"apiBaseUrl": "http://claw-server:8787/api",
|
|
3
|
+
"streamUrl": "ws://claw-server:8787/im-server/ws/bot",
|
|
4
|
+
"apiBaseUrl": "http://claw-server:8787/im-server/api",
|
|
5
5
|
"clawGatewayUrl": "http://claw-gateway:8080",
|
|
6
6
|
"activityReportEnabled": true,
|
|
7
7
|
"sessionTimeout": 1800000,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"enabled": true,
|
|
3
|
-
"streamUrl": "ws://claw-server:8787/ws/bot",
|
|
4
|
-
"apiBaseUrl": "http://claw-server:8787/api",
|
|
3
|
+
"streamUrl": "ws://claw-server:8787/im-server/ws/bot",
|
|
4
|
+
"apiBaseUrl": "http://claw-server:8787/im-server/api",
|
|
5
5
|
"clawGatewayUrl": "http://claw-gateway:8080",
|
|
6
6
|
"activityReportEnabled": true,
|
|
7
7
|
"sessionTimeout": 1800000,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"enabled": true,
|
|
3
|
-
"streamUrl": "ws://claw-server:8787/ws/bot",
|
|
4
|
-
"apiBaseUrl": "http://claw-server:8787/api",
|
|
3
|
+
"streamUrl": "ws://claw-server:8787/im-server/ws/bot",
|
|
4
|
+
"apiBaseUrl": "http://claw-server:8787/im-server/api",
|
|
5
5
|
"clawGatewayUrl": "http://claw-gateway:8080",
|
|
6
6
|
"activityReportEnabled": true,
|
|
7
7
|
"sessionTimeout": 1800000,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"enabled": true,
|
|
3
|
-
"streamUrl": "ws://claw-server:8787/ws/bot",
|
|
4
|
-
"apiBaseUrl": "http://claw-server:8787/api",
|
|
3
|
+
"streamUrl": "ws://claw-server:8787/im-server/ws/bot",
|
|
4
|
+
"apiBaseUrl": "http://claw-server:8787/im-server/api",
|
|
5
5
|
"clawGatewayUrl": "http://claw-gateway:8080",
|
|
6
6
|
"activityReportEnabled": true,
|
|
7
7
|
"sessionTimeout": 1800000,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"enabled": true,
|
|
3
|
-
"streamUrl": "ws://claw-server:8787/ws/bot",
|
|
4
|
-
"apiBaseUrl": "http://claw-server:8787/api",
|
|
3
|
+
"streamUrl": "ws://claw-server:8787/im-server/ws/bot",
|
|
4
|
+
"apiBaseUrl": "http://claw-server:8787/im-server/api",
|
|
5
5
|
"clawGatewayUrl": "http://claw-gateway:8080",
|
|
6
6
|
"activityReportEnabled": true,
|
|
7
7
|
"sessionTimeout": 1800000,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"enabled": true,
|
|
3
|
-
"streamUrl": "ws://claw-server:8787/ws/bot",
|
|
4
|
-
"apiBaseUrl": "http://claw-server:8787/api",
|
|
3
|
+
"streamUrl": "ws://claw-server:8787/im-server/ws/bot",
|
|
4
|
+
"apiBaseUrl": "http://claw-server:8787/im-server/api",
|
|
5
5
|
"clawGatewayUrl": "http://claw-gateway:8080",
|
|
6
6
|
"activityReportEnabled": true,
|
|
7
7
|
"sessionTimeout": 1800000,
|
package/src/gateway-relay.js
CHANGED
|
@@ -243,15 +243,16 @@ function modelResponseFromGatewayData(data) {
|
|
|
243
243
|
return new Response(body, { status, headers: { "Content-Type": contentType } });
|
|
244
244
|
}
|
|
245
245
|
async function relayOpenClawRequest(input, url, init, relay) {
|
|
246
|
+
const inboundHeaders = headersFromFetchInput(input, init);
|
|
247
|
+
if (isGatewayOpenClawAgentRelayHop(inboundHeaders)) {
|
|
248
|
+
relay.log?.("[GATEWAY_RELAY] skip gateway-originated OpenClaw agent relay hop; continuing locator model fetch");
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
246
251
|
const requestBody = await requestBodyFromFetchInput(input, init);
|
|
247
252
|
if (!normalize(relay.relayUrl))
|
|
248
253
|
throw new Error(gatewayRelayNotConfiguredError);
|
|
249
254
|
if (!requestBody)
|
|
250
255
|
throw new Error("failed to capture OpenClaw request body for palz gateway relay");
|
|
251
|
-
const inboundHeaders = headersFromFetchInput(input, init);
|
|
252
|
-
if (isGatewayOpenClawAgentRelayHop(inboundHeaders)) {
|
|
253
|
-
throw new Error("palz gateway relay captured gateway-originated OpenClaw agent hop");
|
|
254
|
-
}
|
|
255
256
|
const headers = { "Content-Type": "application/json" };
|
|
256
257
|
if (normalize(relay.apiKey))
|
|
257
258
|
headers["X-API-Key"] = normalize(relay.apiKey);
|
|
@@ -300,7 +301,8 @@ async function relayOpenClawRequest(input, url, init, relay) {
|
|
|
300
301
|
const parsed = parseGatewayRelayResponseText(raw);
|
|
301
302
|
const data = parsed?.data ? parsed.data : parsed;
|
|
302
303
|
if (data?.skippedInternalRelay) {
|
|
303
|
-
|
|
304
|
+
relay.log?.(`[GATEWAY_RELAY] gateway relay skipped internal OpenClaw agent loop reason=${normalize(data.skipReason)}; continuing locator model fetch`);
|
|
305
|
+
return null;
|
|
304
306
|
}
|
|
305
307
|
if (!resp.ok || !data || data.ok === false) {
|
|
306
308
|
throw new Error(`gateway relay failed status=${resp.status} body=${raw.slice(0, 500)}`);
|
|
@@ -324,7 +326,10 @@ export function installPalzGatewayRelayFetchPatch() {
|
|
|
324
326
|
return originalFetch(input, init);
|
|
325
327
|
}
|
|
326
328
|
const nextInit = withLocatorHeaders(init, relay);
|
|
327
|
-
|
|
329
|
+
const relayResponse = await relayOpenClawRequest(input, requestURL(input), nextInit, relay);
|
|
330
|
+
if (relayResponse)
|
|
331
|
+
return relayResponse;
|
|
332
|
+
return originalFetch(input, nextInit);
|
|
328
333
|
};
|
|
329
334
|
fetchPatched = true;
|
|
330
335
|
}
|