palz-connector 1.6.7 → 1.6.8

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "palz-connector",
3
3
  "name": "Palz Connector Channel",
4
- "version": "1.6.7",
4
+ "version": "1.6.8",
5
5
  "description": "Palz IM 接入 OpenClaw",
6
6
  "channels": [
7
7
  "palz-connector"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palz-connector",
3
- "version": "1.6.7",
3
+ "version": "1.6.8",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "description": "Palz IM 接入 OpenClaw — 模块化架构,基于 OpenClaw Runtime 消息管道",
package/src/bot.js CHANGED
@@ -9,7 +9,7 @@
9
9
  * - 通过 OpenClaw Runtime 的 dispatchReplyFromConfig 完成 AI 对话
10
10
  * - Session 管理交由 OpenClaw Runtime(resolveAgentRoute)
11
11
  */
12
- import { hostname as getHostname } from "node:os";
12
+ import { networkInterfaces } from "node:os";
13
13
  import { getPalzRuntime } from "./runtime.js";
14
14
  import { resolvePalzAccount } from "./config.js";
15
15
  import { tryClaimMessage } from "./dedup.js";
@@ -239,19 +239,26 @@ function buildKbIngestNoticeMessage(results) {
239
239
  ...lines,
240
240
  ].join("\n");
241
241
  }
242
- function resolveWorkspacePoolServiceName() {
243
- const explicit = process.env.OPENCLAW_WORKSPACE_POOL_SERVICE_NAME?.trim();
244
- if (explicit)
245
- return explicit;
246
- const currentHostname = getHostname().trim();
247
- const parts = currentHostname.split("-").filter(Boolean);
248
- if (parts.length >= 3)
249
- return parts.slice(0, 3).join("-");
250
- return currentHostname || "127.0.0.1";
242
+ /**
243
+ * 解析回调 host:直接探测本 pod 的网卡 IP,让 kb engine 绕过 Service 直连本 pod。
244
+ * 取第一个非 internal 的 IPv4 地址,在 K8s pod 内即为 pod IP。
245
+ * 探测不到时兜底用 127.0.0.1。
246
+ */
247
+ function resolveKbCallbackHost() {
248
+ const ifaces = networkInterfaces();
249
+ for (const addrs of Object.values(ifaces)) {
250
+ if (!addrs)
251
+ continue;
252
+ for (const addr of addrs) {
253
+ if (addr.family === "IPv4" && !addr.internal)
254
+ return addr.address;
255
+ }
256
+ }
257
+ return "127.0.0.1";
251
258
  }
252
259
  function resolveKbIngestCallbackUrl(config) {
253
260
  if (typeof config.controlPort === "number" && config.controlPort > 0) {
254
- const host = resolveWorkspacePoolServiceName();
261
+ const host = resolveKbCallbackHost();
255
262
  return `http://${host}:${config.controlPort}/admin/kb-ingest/callback`;
256
263
  }
257
264
  return undefined;