@okxweb3/a2a-node 0.0.19 → 0.0.20-beta-17d080241c-260626095524

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.
Files changed (3) hide show
  1. package/dist/cli.js +76 -17
  2. package/dist/index.js +73 -14
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -7577,7 +7577,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
7577
7577
  client: {
7578
7578
  id: "gateway-client",
7579
7579
  displayName: "okx-a2a-node",
7580
- version: "0.0.19",
7580
+ version: "0.0.20-beta-17d080241c-260626095524",
7581
7581
  platform: "node",
7582
7582
  mode: "backend",
7583
7583
  instanceId
@@ -7588,7 +7588,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
7588
7588
  commands: [],
7589
7589
  permissions: {},
7590
7590
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
7591
- userAgent: `okx-a2a-node/${"0.0.19"}`,
7591
+ userAgent: `okx-a2a-node/${"0.0.20-beta-17d080241c-260626095524"}`,
7592
7592
  auth: {
7593
7593
  ...config.token ? { token: config.token } : {},
7594
7594
  ...config.password ? { password: config.password } : {}
@@ -7927,7 +7927,7 @@ var init_openclaw_session_key = __esm({
7927
7927
  function currentOpenClawGatewaySessionKey(env = process.env) {
7928
7928
  for (const candidate of currentOpenClawGatewaySessionCandidates(env)) {
7929
7929
  if (candidate.ok) {
7930
- return candidate.sessionKey;
7930
+ return canonicalizeOpenClawGatewaySessionKey(candidate.sessionKey);
7931
7931
  }
7932
7932
  }
7933
7933
  return null;
@@ -7952,11 +7952,12 @@ function bindOpenClawGatewayRouteFromEnv(store, input, env = process.env) {
7952
7952
  });
7953
7953
  continue;
7954
7954
  }
7955
- const channel = channelFromOpenClawGatewaySessionKey(candidate.sessionKey);
7955
+ const sessionKey = canonicalizeOpenClawGatewaySessionKey(candidate.sessionKey);
7956
+ const channel = channelFromOpenClawGatewaySessionKey(sessionKey);
7956
7957
  if (!channel) {
7957
7958
  logOpenClawRouteSkip("invalid_gateway_session_key", {
7958
7959
  jobId,
7959
- sessionKey: candidate.sessionKey,
7960
+ sessionKey,
7960
7961
  existingRoute: resolveOpenClawGatewayRoute(store, { jobId })
7961
7962
  });
7962
7963
  continue;
@@ -7966,7 +7967,7 @@ function bindOpenClawGatewayRouteFromEnv(store, input, env = process.env) {
7966
7967
  firstBound ??= existingRoute.gatewaySessionKey || existingRoute.sessionKey || null;
7967
7968
  continue;
7968
7969
  }
7969
- const route = buildOpenClawRouteEntry(candidate.sessionKey, channel);
7970
+ const route = buildOpenClawRouteEntry(sessionKey, channel);
7970
7971
  routes = [...routes, route];
7971
7972
  const binding = store.upsertJobGatewayRoute({ jobId, provider: "openclaw", route });
7972
7973
  if (binding.provider !== "openclaw") {
@@ -8053,7 +8054,9 @@ function readOpenClawRouteEntries(store, jobId) {
8053
8054
  const channelOrder = [];
8054
8055
  const routeByChannel = /* @__PURE__ */ new Map();
8055
8056
  for (const route of routes) {
8056
- const sessionKey = normalizeText(route.gatewaySessionKey) ?? normalizeText(route.sessionKey);
8057
+ const sessionKey = canonicalizeOpenClawGatewaySessionKey(
8058
+ normalizeText(route.gatewaySessionKey) ?? normalizeText(route.sessionKey) ?? ""
8059
+ );
8057
8060
  const channel = channelFromOpenClawGatewaySessionKey(sessionKey);
8058
8061
  if (!sessionKey || !channel) {
8059
8062
  continue;
@@ -8106,20 +8109,70 @@ function parseOpenClawGatewaySessionKey(sessionKey) {
8106
8109
  };
8107
8110
  }
8108
8111
  if (platform === "telegram" && targetKind === "direct") {
8112
+ const threadId = parseTelegramTopicSuffix(parts.slice(5));
8109
8113
  return {
8110
8114
  ...parts[4] ? { chatId: parts[4] } : {},
8115
+ ...threadId ? { threadId } : {},
8116
+ chatType: "dm"
8117
+ };
8118
+ }
8119
+ if (platform === "telegram" && targetKind === "dm") {
8120
+ const threadId = parseTelegramTopicSuffix(parts.slice(5));
8121
+ return {
8122
+ ...parts[4] ? { chatId: parts[4] } : {},
8123
+ ...threadId ? { threadId } : {},
8111
8124
  chatType: "dm"
8112
8125
  };
8113
8126
  }
8114
8127
  if (platform === "telegram" && targetKind === "group") {
8128
+ const threadId = parts[5] === "topic" ? parts[6] : parts[5];
8115
8129
  return {
8116
8130
  ...parts[4] ? { chatId: parts[4] } : {},
8117
- ...parts[6] ? { threadId: parts[6] } : {},
8118
- chatType: parts[6] ? "thread" : "group"
8131
+ ...threadId ? { threadId } : {},
8132
+ chatType: threadId ? "thread" : "group"
8119
8133
  };
8120
8134
  }
8121
8135
  return {};
8122
8136
  }
8137
+ function canonicalizeOpenClawGatewaySessionKey(sessionKey) {
8138
+ const key = normalizeText(sessionKey);
8139
+ if (!key) {
8140
+ return sessionKey;
8141
+ }
8142
+ const parts = key.split(":");
8143
+ if (parts.length < 4 || parts[0] !== "agent") {
8144
+ return key;
8145
+ }
8146
+ const platform = parts[2];
8147
+ const targetKind = parts[3];
8148
+ if (platform !== "telegram") {
8149
+ return key;
8150
+ }
8151
+ if ((targetKind === "direct" || targetKind === "dm") && parts[4]) {
8152
+ const threadId = parseTelegramTopicSuffix(parts.slice(5));
8153
+ return threadId ? `agent:${parts[1]}:telegram:direct:${parts[4]}:topic:${threadId}` : `agent:${parts[1]}:telegram:direct:${parts[4]}`;
8154
+ }
8155
+ if (targetKind === "group" && parts[4]) {
8156
+ const threadId = parts[5] === "topic" ? parts[6] : parts[5];
8157
+ return threadId ? `agent:${parts[1]}:telegram:group:${parts[4]}:topic:${threadId}` : `agent:${parts[1]}:telegram:group:${parts[4]}`;
8158
+ }
8159
+ return key;
8160
+ }
8161
+ function parseTelegramTopicSuffix(parts) {
8162
+ if (parts.length === 0) {
8163
+ return void 0;
8164
+ }
8165
+ if (parts[0] === "topic") {
8166
+ return parts[1] || void 0;
8167
+ }
8168
+ if (parts[0] === "thread") {
8169
+ if (parts.length >= 3) {
8170
+ return parts.slice(2).join(":") || void 0;
8171
+ }
8172
+ return parts[1] || void 0;
8173
+ }
8174
+ return parts[0] || void 0;
8175
+ }
8123
8176
  function validateOpenClawGatewaySessionKey(sessionKey) {
8124
8177
  const key = normalizeText(sessionKey);
8125
8178
  if (!key) {
@@ -8159,10 +8212,16 @@ function deriveOpenClawGatewaySessionKey(input) {
8159
8212
  const chatId = encodeURIComponent(input.chatId);
8160
8213
  const threadId = input.threadId ? encodeURIComponent(input.threadId) : "";
8161
8214
  if (input.platform === "telegram") {
8162
- return threadId ? `agent:main:telegram:group:${chatId}:topic:${threadId}` : `agent:main:telegram:direct:${chatId}`;
8215
+ if (!threadId) {
8216
+ return `agent:main:telegram:direct:${chatId}`;
8217
+ }
8218
+ return isTelegramGroupChatId(input.chatId) ? `agent:main:telegram:group:${chatId}:topic:${threadId}` : `agent:main:telegram:direct:${chatId}:topic:${threadId}`;
8163
8219
  }
8164
8220
  return threadId ? `agent:main:${input.platform}:thread:${chatId}:${threadId}` : `agent:main:${input.platform}:dm:${chatId}`;
8165
8221
  }
8222
+ function isTelegramGroupChatId(chatId) {
8223
+ return chatId.startsWith("-") || chatId.startsWith("@");
8224
+ }
8166
8225
  function readGatewaySessionKeysEnv(env) {
8167
8226
  const raw = normalizeText(env[CURRENT_GATEWAY_SESSION_KEYS_ENV]);
8168
8227
  if (!raw) {
@@ -24748,7 +24807,7 @@ var init_sentry_config = __esm({
24748
24807
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
24749
24808
  SENTRY_CONFIG = {
24750
24809
  projectName: "okx/openclaw-okx-a2a-extension",
24751
- release: "0.0.19",
24810
+ release: "0.0.20-beta-17d080241c-260626095524",
24752
24811
  environment
24753
24812
  };
24754
24813
  }
@@ -92488,12 +92547,12 @@ async function runListenerWithLock(options, paths) {
92488
92547
  }));
92489
92548
  }
92490
92549
  });
92491
- service.setPluginVersion("0.0.19");
92550
+ service.setPluginVersion("0.0.20-beta-17d080241c-260626095524");
92492
92551
  await service.init();
92493
92552
  const pluginVersionStatus = service.pluginVersionStatus;
92494
92553
  if (pluginVersionStatus.unavailable) {
92495
92554
  throw new Error(
92496
- `@okxweb3/a2a-node v${"0.0.19"} is below the required minimum v${pluginVersionStatus.minVersion}`
92555
+ `@okxweb3/a2a-node v${"0.0.20-beta-17d080241c-260626095524"} is below the required minimum v${pluginVersionStatus.minVersion}`
92497
92556
  );
92498
92557
  }
92499
92558
  const systemConfig = service.getSystemConfig();
@@ -92511,7 +92570,7 @@ async function runListenerWithLock(options, paths) {
92511
92570
  onchainosAgentId: "*",
92512
92571
  reason: "system-config missing sentryDsn",
92513
92572
  pluginId: "@okxweb3/a2a-node",
92514
- pluginVersion: "0.0.19"
92573
+ pluginVersion: "0.0.20-beta-17d080241c-260626095524"
92515
92574
  });
92516
92575
  }
92517
92576
  logWithTimestamp(
@@ -95623,7 +95682,7 @@ async function getCurrentNodeCliVersion() {
95623
95682
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
95624
95683
  }
95625
95684
  function getBundledNodeCliVersion() {
95626
- return true ? "0.0.19" : null;
95685
+ return true ? "0.0.20-beta-17d080241c-260626095524" : null;
95627
95686
  }
95628
95687
  function readConfiguredAiProvider() {
95629
95688
  const explicit = process.env.OKX_AGENT_TASK_AI_CLI ?? process.env.OKX_A2A_AI_PROVIDER;
@@ -96456,7 +96515,7 @@ init_sentry_logger();
96456
96515
  init_sentry_config();
96457
96516
  var CURRENT_GATEWAY_SESSION_KEYS_ENV2 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
96458
96517
  function printUsage2() {
96459
- console.log(`okx-a2a ${"0.0.19"}
96518
+ console.log(`okx-a2a ${"0.0.20-beta-17d080241c-260626095524"}
96460
96519
 
96461
96520
  Usage:
96462
96521
  okx-a2a <command> [options]
@@ -96493,7 +96552,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
96493
96552
  `);
96494
96553
  }
96495
96554
  function printVersion() {
96496
- console.log("0.0.19");
96555
+ console.log("0.0.20-beta-17d080241c-260626095524");
96497
96556
  }
96498
96557
  function printDaemonUsage() {
96499
96558
  console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
package/dist/index.js CHANGED
@@ -86421,7 +86421,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
86421
86421
  client: {
86422
86422
  id: "gateway-client",
86423
86423
  displayName: "okx-a2a-node",
86424
- version: "0.0.19",
86424
+ version: "0.0.20-beta-17d080241c-260626095524",
86425
86425
  platform: "node",
86426
86426
  mode: "backend",
86427
86427
  instanceId
@@ -86432,7 +86432,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
86432
86432
  commands: [],
86433
86433
  permissions: {},
86434
86434
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
86435
- userAgent: `okx-a2a-node/${"0.0.19"}`,
86435
+ userAgent: `okx-a2a-node/${"0.0.20-beta-17d080241c-260626095524"}`,
86436
86436
  auth: {
86437
86437
  ...config.token ? { token: config.token } : {},
86438
86438
  ...config.password ? { password: config.password } : {}
@@ -86568,7 +86568,7 @@ var ACTIVE_ORIGIN_TTL_MS = 30 * 6e4;
86568
86568
  function currentOpenClawGatewaySessionKey(env = process.env) {
86569
86569
  for (const candidate of currentOpenClawGatewaySessionCandidates(env)) {
86570
86570
  if (candidate.ok) {
86571
- return candidate.sessionKey;
86571
+ return canonicalizeOpenClawGatewaySessionKey(candidate.sessionKey);
86572
86572
  }
86573
86573
  }
86574
86574
  return null;
@@ -86593,11 +86593,12 @@ function bindOpenClawGatewayRouteFromEnv(store, input, env = process.env) {
86593
86593
  });
86594
86594
  continue;
86595
86595
  }
86596
- const channel = channelFromOpenClawGatewaySessionKey(candidate.sessionKey);
86596
+ const sessionKey = canonicalizeOpenClawGatewaySessionKey(candidate.sessionKey);
86597
+ const channel = channelFromOpenClawGatewaySessionKey(sessionKey);
86597
86598
  if (!channel) {
86598
86599
  logOpenClawRouteSkip("invalid_gateway_session_key", {
86599
86600
  jobId,
86600
- sessionKey: candidate.sessionKey,
86601
+ sessionKey,
86601
86602
  existingRoute: resolveOpenClawGatewayRoute(store, { jobId })
86602
86603
  });
86603
86604
  continue;
@@ -86607,7 +86608,7 @@ function bindOpenClawGatewayRouteFromEnv(store, input, env = process.env) {
86607
86608
  firstBound ??= existingRoute.gatewaySessionKey || existingRoute.sessionKey || null;
86608
86609
  continue;
86609
86610
  }
86610
- const route = buildOpenClawRouteEntry(candidate.sessionKey, channel);
86611
+ const route = buildOpenClawRouteEntry(sessionKey, channel);
86611
86612
  routes = [...routes, route];
86612
86613
  const binding = store.upsertJobGatewayRoute({ jobId, provider: "openclaw", route });
86613
86614
  if (binding.provider !== "openclaw") {
@@ -86694,7 +86695,9 @@ function readOpenClawRouteEntries(store, jobId) {
86694
86695
  const channelOrder = [];
86695
86696
  const routeByChannel = /* @__PURE__ */ new Map();
86696
86697
  for (const route of routes) {
86697
- const sessionKey = normalizeText(route.gatewaySessionKey) ?? normalizeText(route.sessionKey);
86698
+ const sessionKey = canonicalizeOpenClawGatewaySessionKey(
86699
+ normalizeText(route.gatewaySessionKey) ?? normalizeText(route.sessionKey) ?? ""
86700
+ );
86698
86701
  const channel = channelFromOpenClawGatewaySessionKey(sessionKey);
86699
86702
  if (!sessionKey || !channel) {
86700
86703
  continue;
@@ -86747,20 +86750,70 @@ function parseOpenClawGatewaySessionKey(sessionKey) {
86747
86750
  };
86748
86751
  }
86749
86752
  if (platform === "telegram" && targetKind === "direct") {
86753
+ const threadId = parseTelegramTopicSuffix(parts.slice(5));
86750
86754
  return {
86751
86755
  ...parts[4] ? { chatId: parts[4] } : {},
86756
+ ...threadId ? { threadId } : {},
86757
+ chatType: "dm"
86758
+ };
86759
+ }
86760
+ if (platform === "telegram" && targetKind === "dm") {
86761
+ const threadId = parseTelegramTopicSuffix(parts.slice(5));
86762
+ return {
86763
+ ...parts[4] ? { chatId: parts[4] } : {},
86764
+ ...threadId ? { threadId } : {},
86752
86765
  chatType: "dm"
86753
86766
  };
86754
86767
  }
86755
86768
  if (platform === "telegram" && targetKind === "group") {
86769
+ const threadId = parts[5] === "topic" ? parts[6] : parts[5];
86756
86770
  return {
86757
86771
  ...parts[4] ? { chatId: parts[4] } : {},
86758
- ...parts[6] ? { threadId: parts[6] } : {},
86759
- chatType: parts[6] ? "thread" : "group"
86772
+ ...threadId ? { threadId } : {},
86773
+ chatType: threadId ? "thread" : "group"
86760
86774
  };
86761
86775
  }
86762
86776
  return {};
86763
86777
  }
86778
+ function canonicalizeOpenClawGatewaySessionKey(sessionKey) {
86779
+ const key = normalizeText(sessionKey);
86780
+ if (!key) {
86781
+ return sessionKey;
86782
+ }
86783
+ const parts = key.split(":");
86784
+ if (parts.length < 4 || parts[0] !== "agent") {
86785
+ return key;
86786
+ }
86787
+ const platform = parts[2];
86788
+ const targetKind = parts[3];
86789
+ if (platform !== "telegram") {
86790
+ return key;
86791
+ }
86792
+ if ((targetKind === "direct" || targetKind === "dm") && parts[4]) {
86793
+ const threadId = parseTelegramTopicSuffix(parts.slice(5));
86794
+ return threadId ? `agent:${parts[1]}:telegram:direct:${parts[4]}:topic:${threadId}` : `agent:${parts[1]}:telegram:direct:${parts[4]}`;
86795
+ }
86796
+ if (targetKind === "group" && parts[4]) {
86797
+ const threadId = parts[5] === "topic" ? parts[6] : parts[5];
86798
+ return threadId ? `agent:${parts[1]}:telegram:group:${parts[4]}:topic:${threadId}` : `agent:${parts[1]}:telegram:group:${parts[4]}`;
86799
+ }
86800
+ return key;
86801
+ }
86802
+ function parseTelegramTopicSuffix(parts) {
86803
+ if (parts.length === 0) {
86804
+ return void 0;
86805
+ }
86806
+ if (parts[0] === "topic") {
86807
+ return parts[1] || void 0;
86808
+ }
86809
+ if (parts[0] === "thread") {
86810
+ if (parts.length >= 3) {
86811
+ return parts.slice(2).join(":") || void 0;
86812
+ }
86813
+ return parts[1] || void 0;
86814
+ }
86815
+ return parts[0] || void 0;
86816
+ }
86764
86817
  function validateOpenClawGatewaySessionKey(sessionKey) {
86765
86818
  const key = normalizeText(sessionKey);
86766
86819
  if (!key) {
@@ -86800,10 +86853,16 @@ function deriveOpenClawGatewaySessionKey(input) {
86800
86853
  const chatId = encodeURIComponent(input.chatId);
86801
86854
  const threadId = input.threadId ? encodeURIComponent(input.threadId) : "";
86802
86855
  if (input.platform === "telegram") {
86803
- return threadId ? `agent:main:telegram:group:${chatId}:topic:${threadId}` : `agent:main:telegram:direct:${chatId}`;
86856
+ if (!threadId) {
86857
+ return `agent:main:telegram:direct:${chatId}`;
86858
+ }
86859
+ return isTelegramGroupChatId(input.chatId) ? `agent:main:telegram:group:${chatId}:topic:${threadId}` : `agent:main:telegram:direct:${chatId}:topic:${threadId}`;
86804
86860
  }
86805
86861
  return threadId ? `agent:main:${input.platform}:thread:${chatId}:${threadId}` : `agent:main:${input.platform}:dm:${chatId}`;
86806
86862
  }
86863
+ function isTelegramGroupChatId(chatId) {
86864
+ return chatId.startsWith("-") || chatId.startsWith("@");
86865
+ }
86807
86866
  function readGatewaySessionKeysEnv(env) {
86808
86867
  const raw = normalizeText(env[CURRENT_GATEWAY_SESSION_KEYS_ENV]);
86809
86868
  if (!raw) {
@@ -90588,7 +90647,7 @@ function userWatchEventDeliveredSentryExtra(event) {
90588
90647
  var environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
90589
90648
  var SENTRY_CONFIG = {
90590
90649
  projectName: "okx/openclaw-okx-a2a-extension",
90591
- release: "0.0.19",
90650
+ release: "0.0.20-beta-17d080241c-260626095524",
90592
90651
  environment
90593
90652
  };
90594
90653
 
@@ -90815,12 +90874,12 @@ async function runListenerWithLock(options, paths) {
90815
90874
  }));
90816
90875
  }
90817
90876
  });
90818
- service.setPluginVersion("0.0.19");
90877
+ service.setPluginVersion("0.0.20-beta-17d080241c-260626095524");
90819
90878
  await service.init();
90820
90879
  const pluginVersionStatus = service.pluginVersionStatus;
90821
90880
  if (pluginVersionStatus.unavailable) {
90822
90881
  throw new Error(
90823
- `@okxweb3/a2a-node v${"0.0.19"} is below the required minimum v${pluginVersionStatus.minVersion}`
90882
+ `@okxweb3/a2a-node v${"0.0.20-beta-17d080241c-260626095524"} is below the required minimum v${pluginVersionStatus.minVersion}`
90824
90883
  );
90825
90884
  }
90826
90885
  const systemConfig = service.getSystemConfig();
@@ -90838,7 +90897,7 @@ async function runListenerWithLock(options, paths) {
90838
90897
  onchainosAgentId: "*",
90839
90898
  reason: "system-config missing sentryDsn",
90840
90899
  pluginId: "@okxweb3/a2a-node",
90841
- pluginVersion: "0.0.19"
90900
+ pluginVersion: "0.0.20-beta-17d080241c-260626095524"
90842
90901
  });
90843
90902
  }
90844
90903
  logWithTimestamp(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okxweb3/a2a-node",
3
- "version": "0.0.19",
3
+ "version": "0.0.20-beta-17d080241c-260626095524",
4
4
  "description": "Host-agnostic Node CLI for E2E encrypted agent-to-agent communication via XMTP",
5
5
  "main": "dist/index.js",
6
6
  "bin": {