@okxweb3/a2a-node 0.0.22-beta-e1f6d0f26b-260629152447 → 0.1.0

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 +302 -110
  2. package/dist/index.js +211 -38
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -416,12 +416,17 @@ function normalizeGatewayRouteInput(value, provider) {
416
416
  platform,
417
417
  chatId,
418
418
  chatName: readText(item.chatName) ?? readText(item.chat_name) ?? "",
419
- chatType: normalizeGatewayRouteChatType(readText(item.chatType) ?? readText(item.chat_type), parsedRoute?.chatType, threadId),
419
+ chatType: normalizeGatewayRouteChatType(
420
+ readText(item.chatType) ?? readText(item.chat_type),
421
+ parsedRoute?.chatType,
422
+ threadId
423
+ ),
420
424
  threadId,
421
425
  userId: readText(item.userId) ?? readText(item.user_id) ?? "",
422
426
  userName: readText(item.userName) ?? readText(item.user_name) ?? "",
423
427
  sessionKey,
424
428
  gatewaySessionKey,
429
+ sessionAliases: readTextArray(item.sessionAliases) ?? readTextArray(item.session_aliases) ?? [],
425
430
  updatedAt: readText(item.updatedAt) ?? readText(item.updated_at) ?? ""
426
431
  };
427
432
  }
@@ -438,15 +443,26 @@ function normalizeGatewayRoute(route, updatedAt, provider) {
438
443
  userName: route.userName ?? "",
439
444
  sessionKey: route.sessionKey ?? route.gatewaySessionKey ?? "",
440
445
  gatewaySessionKey: route.gatewaySessionKey ?? route.sessionKey ?? "",
446
+ sessionAliases: normalizeGatewayRouteAliases(route.sessionAliases),
441
447
  updatedAt
442
448
  };
443
449
  }
444
450
  function upsertGatewayRoute(routes, route) {
445
451
  const key = gatewayRouteKey(route);
446
452
  const next = routes.filter((item) => gatewayRouteKey(item) !== key);
447
- next.push(route);
453
+ const existing = routes.find((item) => gatewayRouteKey(item) === key);
454
+ next.push({
455
+ ...route,
456
+ sessionAliases: normalizeGatewayRouteAliases([
457
+ ...existing?.sessionAliases ?? [],
458
+ ...route.sessionAliases ?? []
459
+ ])
460
+ });
448
461
  return next;
449
462
  }
463
+ function normalizeGatewayRouteAliases(values) {
464
+ return [...new Set((values ?? []).map((value) => value.trim()).filter(Boolean))];
465
+ }
450
466
  function gatewayRouteKey(route) {
451
467
  return `${route.platform}
452
468
  ${route.chatId}
@@ -548,6 +564,16 @@ function readText(value) {
548
564
  const trimmed = value.trim();
549
565
  return trimmed || null;
550
566
  }
567
+ function readTextArray(value) {
568
+ if (!Array.isArray(value)) {
569
+ return null;
570
+ }
571
+ const values = value.flatMap((item) => {
572
+ const text = readText(item);
573
+ return text ? [text] : [];
574
+ });
575
+ return normalizeGatewayRouteAliases(values);
576
+ }
551
577
  var import_node_crypto, import_node_fs2, import_node_path3, DatabaseSync, SYSTEM_NOTIFICATION_SESSION_KEY, SessionStore;
552
578
  var init_session_store = __esm({
553
579
  "src/session-store.ts"() {
@@ -2190,7 +2216,7 @@ function isDaemonCommand(value) {
2190
2216
  }
2191
2217
  if (parsed.type === "xmtp-deny-pending-conversation") {
2192
2218
  const command = parsed;
2193
- return typeof command.groupId === "string" || typeof command.jobId === "string";
2219
+ return (typeof command.groupId === "string" || typeof command.jobId === "string") && (command.content === void 0 || typeof command.content === "string");
2194
2220
  }
2195
2221
  if (parsed.type === "xmtp-refresh-agents") {
2196
2222
  return true;
@@ -2263,6 +2289,7 @@ var init_command_store = __esm({
2263
2289
  groupId: params.groupId,
2264
2290
  jobId: params.jobId,
2265
2291
  agentId: params.agentId,
2292
+ content: params.content,
2266
2293
  createdAt: Date.now()
2267
2294
  };
2268
2295
  }
@@ -7819,7 +7846,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
7819
7846
  client: {
7820
7847
  id: "gateway-client",
7821
7848
  displayName: "okx-a2a-node",
7822
- version: "0.0.22-beta-e1f6d0f26b-260629152447",
7849
+ version: "0.1.0",
7823
7850
  platform: "node",
7824
7851
  mode: "backend",
7825
7852
  instanceId
@@ -7830,7 +7857,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
7830
7857
  commands: [],
7831
7858
  permissions: {},
7832
7859
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
7833
- userAgent: `okx-a2a-node/${"0.0.22-beta-e1f6d0f26b-260629152447"}`,
7860
+ userAgent: `okx-a2a-node/${"0.1.0"}`,
7834
7861
  auth: {
7835
7862
  ...config.token ? { token: config.token } : {},
7836
7863
  ...config.password ? { password: config.password } : {}
@@ -25049,7 +25076,7 @@ var init_sentry_config = __esm({
25049
25076
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
25050
25077
  SENTRY_CONFIG = {
25051
25078
  projectName: "okx/openclaw-okx-a2a-extension",
25052
- release: "0.0.22-beta-e1f6d0f26b-260629152447",
25079
+ release: "0.1.0",
25053
25080
  environment
25054
25081
  };
25055
25082
  }
@@ -86734,6 +86761,74 @@ var init_signer = __esm({
86734
86761
  }
86735
86762
  });
86736
86763
 
86764
+ // ../core/src/a2a/pending-conversation.ts
86765
+ function buildPendingConversationBackupNotice(jobId) {
86766
+ return PENDING_CONVERSATION_BACKUP_NOTICE_TEMPLATE.replace("${jobId}", jobId);
86767
+ }
86768
+ var PENDING_CONVERSATION_BACKUP_NOTICE_TEMPLATE;
86769
+ var init_pending_conversation = __esm({
86770
+ "../core/src/a2a/pending-conversation.ts"() {
86771
+ "use strict";
86772
+ PENDING_CONVERSATION_BACKUP_NOTICE_TEMPLATE = "[event:provider_conversation][jobId:${jobId}] There are new conversation requests pending.";
86773
+ }
86774
+ });
86775
+
86776
+ // ../core/src/a2a/index.ts
86777
+ var A2A_MESSAGE_TYPE;
86778
+ var init_a2a = __esm({
86779
+ "../core/src/a2a/index.ts"() {
86780
+ "use strict";
86781
+ init_pending_conversation();
86782
+ A2A_MESSAGE_TYPE = "a2a-agent-chat";
86783
+ }
86784
+ });
86785
+
86786
+ // ../core/src/a2a/envelope.shared.ts
86787
+ function isNonEmptyPlainObject(v) {
86788
+ return !!v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length > 0;
86789
+ }
86790
+ function buildA2AEnvelope(params) {
86791
+ const envelope = {
86792
+ msgType: A2A_MESSAGE_TYPE,
86793
+ content: params.content,
86794
+ contentType: "text",
86795
+ fromXmtpAddress: params.myXmtpAddress,
86796
+ toXmtpAddress: params.toXmtpAddress,
86797
+ groupId: params.groupId,
86798
+ jobId: params.jobId,
86799
+ sender: params.senderAgent ? { agentId: params.senderAgent.agentId, name: params.senderAgent.name, role: params.senderAgent.role } : null,
86800
+ receiverAgentId: params.receiverAgentId ?? null
86801
+ };
86802
+ if (isNonEmptyPlainObject(params.payload)) {
86803
+ envelope.payload = params.payload;
86804
+ }
86805
+ envelope.tips = isNonEmptyPlainObject(params.tips) ? params.tips : DEFAULT_A2A_TIPS;
86806
+ return JSON.stringify(envelope, null, 2);
86807
+ }
86808
+ var DEFAULT_A2A_TIPS;
86809
+ var init_envelope_shared = __esm({
86810
+ "../core/src/a2a/envelope.shared.ts"() {
86811
+ "use strict";
86812
+ init_a2a();
86813
+ DEFAULT_A2A_TIPS = {
86814
+ "task-skill": "Read the okx-agent-task skill if you don't know the context"
86815
+ };
86816
+ }
86817
+ });
86818
+
86819
+ // ../core/src/a2a/envelope.ts
86820
+ function buildSendEnvelope(params) {
86821
+ const tips = XmtpService.getInstance().getSystemConfig().extConfig.tips;
86822
+ return buildA2AEnvelope({ ...params, tips });
86823
+ }
86824
+ var init_envelope = __esm({
86825
+ "../core/src/a2a/envelope.ts"() {
86826
+ "use strict";
86827
+ init_xmtp_sdk();
86828
+ init_envelope_shared();
86829
+ }
86830
+ });
86831
+
86737
86832
  // src/invalid-message-store.ts
86738
86833
  function loadSqlite3() {
86739
86834
  const originalEmitWarning = process.emitWarning;
@@ -86848,74 +86943,6 @@ var init_invalid_message_store = __esm({
86848
86943
  }
86849
86944
  });
86850
86945
 
86851
- // ../core/src/a2a/pending-conversation.ts
86852
- function buildPendingConversationBackupNotice(jobId) {
86853
- return PENDING_CONVERSATION_BACKUP_NOTICE_TEMPLATE.replace("${jobId}", jobId);
86854
- }
86855
- var PENDING_CONVERSATION_BACKUP_NOTICE_TEMPLATE;
86856
- var init_pending_conversation = __esm({
86857
- "../core/src/a2a/pending-conversation.ts"() {
86858
- "use strict";
86859
- PENDING_CONVERSATION_BACKUP_NOTICE_TEMPLATE = "[event:provider_conversation][jobId:${jobId}] There are new conversation requests pending.";
86860
- }
86861
- });
86862
-
86863
- // ../core/src/a2a/index.ts
86864
- var A2A_MESSAGE_TYPE;
86865
- var init_a2a = __esm({
86866
- "../core/src/a2a/index.ts"() {
86867
- "use strict";
86868
- init_pending_conversation();
86869
- A2A_MESSAGE_TYPE = "a2a-agent-chat";
86870
- }
86871
- });
86872
-
86873
- // ../core/src/a2a/envelope.shared.ts
86874
- function isNonEmptyPlainObject(v) {
86875
- return !!v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length > 0;
86876
- }
86877
- function buildA2AEnvelope(params) {
86878
- const envelope = {
86879
- msgType: A2A_MESSAGE_TYPE,
86880
- content: params.content,
86881
- contentType: "text",
86882
- fromXmtpAddress: params.myXmtpAddress,
86883
- toXmtpAddress: params.toXmtpAddress,
86884
- groupId: params.groupId,
86885
- jobId: params.jobId,
86886
- sender: params.senderAgent ? { agentId: params.senderAgent.agentId, name: params.senderAgent.name, role: params.senderAgent.role } : null,
86887
- receiverAgentId: params.receiverAgentId ?? null
86888
- };
86889
- if (isNonEmptyPlainObject(params.payload)) {
86890
- envelope.payload = params.payload;
86891
- }
86892
- envelope.tips = isNonEmptyPlainObject(params.tips) ? params.tips : DEFAULT_A2A_TIPS;
86893
- return JSON.stringify(envelope, null, 2);
86894
- }
86895
- var DEFAULT_A2A_TIPS;
86896
- var init_envelope_shared = __esm({
86897
- "../core/src/a2a/envelope.shared.ts"() {
86898
- "use strict";
86899
- init_a2a();
86900
- DEFAULT_A2A_TIPS = {
86901
- "task-skill": "Read the okx-agent-task skill if you don't know the context"
86902
- };
86903
- }
86904
- });
86905
-
86906
- // ../core/src/a2a/envelope.ts
86907
- function buildSendEnvelope(params) {
86908
- const tips = XmtpService.getInstance().getSystemConfig().extConfig.tips;
86909
- return buildA2AEnvelope({ ...params, tips });
86910
- }
86911
- var init_envelope = __esm({
86912
- "../core/src/a2a/envelope.ts"() {
86913
- "use strict";
86914
- init_xmtp_sdk();
86915
- init_envelope_shared();
86916
- }
86917
- });
86918
-
86919
86946
  // ../core/src/a2a/concurrency.ts
86920
86947
  async function withSharedPromise(registry, key, fn) {
86921
86948
  const existing = registry.get(key);
@@ -90854,27 +90881,51 @@ async function handleDaemonCommand(command, params) {
90854
90881
  if (command.jobId) {
90855
90882
  return {
90856
90883
  ok: true,
90857
- payload: await denyPendingConversationsByJobId(command.jobId, params)
90884
+ payload: await denyPendingConversationsByJobId(command.jobId, params, command.content)
90858
90885
  };
90859
90886
  }
90860
90887
  if (!command.groupId) {
90861
90888
  throw new Error("xmtp-deny-pending-conversation requires groupId or jobId");
90862
90889
  }
90890
+ const groupId = command.groupId;
90863
90891
  if (command.agentId) {
90864
90892
  const address = params.service.getAddressByAgentId(command.agentId);
90865
90893
  if (!address) {
90866
90894
  throw new Error(`No address found for agentId=${command.agentId}`);
90867
90895
  }
90868
- const denied = await params.service.denyGroup(address, command.groupId);
90869
- return { ok: true, payload: { denied, groupId: command.groupId, agentId: command.agentId, deniedClientCount: denied ? 1 : 0 } };
90870
- }
90871
- const deniedOn = [];
90872
- for (const [address] of params.service.getClients()) {
90873
- if (await params.service.denyGroup(address, command.groupId)) {
90874
- deniedOn.push(address);
90896
+ const targets2 = [{ address, groupId }];
90897
+ if (command.content) {
90898
+ const sendTargets = await resolvePendingTargetsByGroupIdBestEffort(groupId, [address], params);
90899
+ await sendRejectContentToTargets(command.content, sendTargets, params);
90875
90900
  }
90901
+ const results2 = await denyTargets(targets2, params);
90902
+ const deniedOn2 = results2.filter((result) => result.denied).map(({ address: resultAddress, groupId: resultGroupId }) => ({ address: resultAddress, groupId: resultGroupId }));
90903
+ return {
90904
+ ok: true,
90905
+ payload: {
90906
+ denied: deniedOn2.length > 0,
90907
+ groupId,
90908
+ agentId: command.agentId,
90909
+ deniedClientCount: deniedOn2.length
90910
+ }
90911
+ };
90876
90912
  }
90877
- return { ok: true, payload: { denied: deniedOn.length > 0, groupId: command.groupId, deniedClientCount: deniedOn.length, deniedOn } };
90913
+ const targets = [...params.service.getClients().keys()].map((address) => ({ address, groupId }));
90914
+ if (command.content) {
90915
+ const sendTargets = await resolvePendingTargetsByGroupIdBestEffort(groupId, null, params);
90916
+ await sendRejectContentToTargets(command.content, sendTargets, params);
90917
+ }
90918
+ const results = await denyTargets(targets, params);
90919
+ const deniedOn = results.filter((result) => result.denied).map(({ address }) => address);
90920
+ return {
90921
+ ok: true,
90922
+ payload: {
90923
+ denied: deniedOn.length > 0,
90924
+ groupId,
90925
+ deniedClientCount: deniedOn.length,
90926
+ deniedOn
90927
+ }
90928
+ };
90878
90929
  }
90879
90930
  if (command.type === "xmtp-get-conversation-history") {
90880
90931
  const payload = await handleXmtpGetConversationHistory(command, params);
@@ -90899,11 +90950,11 @@ async function listPendingTaskRequests(params) {
90899
90950
  }
90900
90951
  return filterKnownPendingGroups(result, params.sessionStore);
90901
90952
  }
90902
- async function denyPendingConversationsByJobId(jobId, params) {
90953
+ async function denyPendingConversationsByJobId(jobId, params, content3) {
90903
90954
  const pending = await listPendingTaskRequests(params);
90904
90955
  const matched = pending.filter((item) => isPlainObject2(item) && readString2(item.jobId) === jobId);
90905
90956
  const clientAddresses = [...params.service.getClients().keys()];
90906
- const targetsByKey = /* @__PURE__ */ new Map();
90957
+ const targetsByKey = collectDenyTargetsFromPending(matched, clientAddresses);
90907
90958
  const groupIds = /* @__PURE__ */ new Set();
90908
90959
  for (const item of matched) {
90909
90960
  if (!isPlainObject2(item)) {
@@ -90914,19 +90965,12 @@ async function denyPendingConversationsByJobId(jobId, params) {
90914
90965
  continue;
90915
90966
  }
90916
90967
  groupIds.add(groupId);
90917
- const address = readString2(item.myXmtpAddress);
90918
- const addresses = address ? [address] : clientAddresses;
90919
- for (const candidate of addresses) {
90920
- targetsByKey.set(`${candidate}
90921
- ${groupId}`, { address: candidate, groupId });
90922
- }
90923
90968
  }
90924
- const results = await Promise.all(
90925
- [...targetsByKey.values()].map(async (target) => ({
90926
- ...target,
90927
- denied: await params.service.denyGroup(target.address, target.groupId)
90928
- }))
90929
- );
90969
+ const targets = [...targetsByKey.values()];
90970
+ if (content3) {
90971
+ await sendRejectContentToTargets(content3, targets, params);
90972
+ }
90973
+ const results = await denyTargets(targets, params);
90930
90974
  const deniedOn = results.filter((result) => result.denied).map(({ address, groupId }) => ({ address, groupId }));
90931
90975
  return {
90932
90976
  denied: deniedOn.length > 0,
@@ -90937,6 +90981,135 @@ ${groupId}`, { address: candidate, groupId });
90937
90981
  deniedOn
90938
90982
  };
90939
90983
  }
90984
+ function collectDenyTargetsFromPending(pending, fallbackAddresses) {
90985
+ const targetsByKey = /* @__PURE__ */ new Map();
90986
+ for (const item of pending) {
90987
+ if (!isPlainObject2(item)) {
90988
+ continue;
90989
+ }
90990
+ const groupId = readString2(item.groupId);
90991
+ if (!groupId) {
90992
+ continue;
90993
+ }
90994
+ const address = readString2(item.myXmtpAddress);
90995
+ const addresses = address ? [address] : fallbackAddresses;
90996
+ for (const candidate of addresses) {
90997
+ targetsByKey.set(`${candidate}
90998
+ ${groupId}`, {
90999
+ address: candidate,
91000
+ groupId,
91001
+ jobId: readString2(item.jobId),
91002
+ toXmtpAddress: readString2(item.toXmtpAddress),
91003
+ toAgentId: readString2(item.toAgentId)
91004
+ });
91005
+ }
91006
+ }
91007
+ return targetsByKey;
91008
+ }
91009
+ async function resolvePendingTargetsByGroupId(groupId, addresses, params) {
91010
+ const addressSet = addresses ? new Set(addresses) : null;
91011
+ const pending = (await listPendingTaskRequests(params)).filter((item) => {
91012
+ if (!isPlainObject2(item) || readString2(item.groupId) !== groupId) {
91013
+ return false;
91014
+ }
91015
+ const address = readString2(item.myXmtpAddress);
91016
+ return !addressSet || !address || addressSet.has(address);
91017
+ });
91018
+ const targets = [...collectDenyTargetsFromPending(
91019
+ pending,
91020
+ addresses ?? [...params.service.getClients().keys()]
91021
+ ).values()];
91022
+ if (targets.length === 0) {
91023
+ const addressHint = addresses?.length ? ` address=${addresses.join(",")}` : "";
91024
+ throw new Error(`Cannot send task reject content: no pending XMTP group metadata found for groupId=${groupId}${addressHint}`);
91025
+ }
91026
+ return targets;
91027
+ }
91028
+ async function resolvePendingTargetsByGroupIdBestEffort(groupId, addresses, params) {
91029
+ try {
91030
+ return await resolvePendingTargetsByGroupId(groupId, addresses, params);
91031
+ } catch (err2) {
91032
+ reportRejectContentSendFailure(err2, {
91033
+ stage: "resolve-targets",
91034
+ groupId,
91035
+ addresses
91036
+ });
91037
+ return [];
91038
+ }
91039
+ }
91040
+ async function sendRejectContentToTargets(content3, targets, params) {
91041
+ await Promise.all(targets.map(async (target) => {
91042
+ try {
91043
+ await sendRejectContentToTarget(content3, target, params);
91044
+ } catch (err2) {
91045
+ reportRejectContentSendFailure(err2, {
91046
+ stage: "send",
91047
+ groupId: target.groupId,
91048
+ address: target.address,
91049
+ jobId: target.jobId ?? void 0,
91050
+ toAgentId: target.toAgentId ?? void 0,
91051
+ toXmtpAddress: target.toXmtpAddress ?? void 0
91052
+ });
91053
+ }
91054
+ }));
91055
+ }
91056
+ function reportRejectContentSendFailure(err2, context) {
91057
+ const error = err2 instanceof Error ? err2 : new Error(String(err2));
91058
+ logWithTimestamp("[okx-agent-task] task reject content send failed, continuing with deny:", error);
91059
+ logger.error(LogEvent.XMTP_SEND_FAILED, error, {
91060
+ component: "node_command_processor",
91061
+ command: "xmtp-deny-pending-conversation",
91062
+ optional: "true",
91063
+ ...Object.fromEntries(
91064
+ Object.entries(context).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => [key, Array.isArray(value) ? value.join(",") : String(value)])
91065
+ )
91066
+ });
91067
+ }
91068
+ async function sendRejectContentToTarget(content3, target, params) {
91069
+ const jobId = target.jobId;
91070
+ if (!jobId) {
91071
+ throw new Error(`Cannot send task reject content: jobId missing for groupId=${target.groupId} address=${target.address}`);
91072
+ }
91073
+ const receiverAgent = target.toAgentId ? params.service.getAgentByAgentId(target.toAgentId) : void 0;
91074
+ const toXmtpAddress = target.toXmtpAddress ?? receiverAgent?.communicationAddress ?? null;
91075
+ if (!toXmtpAddress) {
91076
+ throw new Error(`Cannot send task reject content: toXmtpAddress missing for groupId=${target.groupId} address=${target.address}`);
91077
+ }
91078
+ const agent = params.service.getClientByAddress(target.address);
91079
+ const conversations = agent?.client?.conversations;
91080
+ if (!conversations) {
91081
+ throw new Error(`No XMTP client found for address=${target.address}`);
91082
+ }
91083
+ const conversation = typeof conversations.getConversationById === "function" ? await conversations.getConversationById(target.groupId) : null;
91084
+ if (!conversation || typeof conversation.send !== "function") {
91085
+ throw new Error(`conversation not found for groupId=${target.groupId} address=${target.address}`);
91086
+ }
91087
+ const senderAgent = params.service.getAgentByAddress(target.address);
91088
+ const rawText = buildSendEnvelope({
91089
+ content: content3,
91090
+ myXmtpAddress: target.address,
91091
+ toXmtpAddress,
91092
+ groupId: target.groupId,
91093
+ jobId,
91094
+ senderAgent,
91095
+ receiverAgentId: receiverAgent?.agentId ?? target.toAgentId ?? null,
91096
+ payload: {
91097
+ taskMinVersion: 1,
91098
+ source: "okx-agent-task",
91099
+ replyToMessageId: null
91100
+ }
91101
+ });
91102
+ logWithTimestamp(`[okx-agent-task] task reject xmtp envelope ${rawText}`);
91103
+ await conversation.send(rawText);
91104
+ }
91105
+ async function denyTargets(targets, params) {
91106
+ return await Promise.all(
91107
+ targets.map(async (target) => ({
91108
+ ...target,
91109
+ denied: await params.service.denyGroup(target.address, target.groupId)
91110
+ }))
91111
+ );
91112
+ }
90940
91113
  function filterKnownPendingGroups(items, sessionStore) {
90941
91114
  if (!sessionStore) {
90942
91115
  return items;
@@ -91242,6 +91415,7 @@ var init_command_processor = __esm({
91242
91415
  "src/command-processor.ts"() {
91243
91416
  "use strict";
91244
91417
  init_log();
91418
+ init_envelope();
91245
91419
  init_command_store();
91246
91420
  init_invalid_message_store();
91247
91421
  init_xmtp_send();
@@ -92875,12 +93049,12 @@ async function runListenerWithLock(options, paths) {
92875
93049
  }));
92876
93050
  }
92877
93051
  });
92878
- service.setPluginVersion("0.0.22-beta-e1f6d0f26b-260629152447");
93052
+ service.setPluginVersion("0.1.0");
92879
93053
  await service.init();
92880
93054
  const pluginVersionStatus = service.pluginVersionStatus;
92881
93055
  if (pluginVersionStatus.unavailable) {
92882
93056
  throw new Error(
92883
- `@okxweb3/a2a-node v${"0.0.22-beta-e1f6d0f26b-260629152447"} is below the required minimum v${pluginVersionStatus.minVersion}`
93057
+ `@okxweb3/a2a-node v${"0.1.0"} is below the required minimum v${pluginVersionStatus.minVersion}`
92884
93058
  );
92885
93059
  }
92886
93060
  const systemConfig = service.getSystemConfig();
@@ -92898,7 +93072,7 @@ async function runListenerWithLock(options, paths) {
92898
93072
  onchainosAgentId: "*",
92899
93073
  reason: "system-config missing sentryDsn",
92900
93074
  pluginId: "@okxweb3/a2a-node",
92901
- pluginVersion: "0.0.22-beta-e1f6d0f26b-260629152447"
93075
+ pluginVersion: "0.1.0"
92902
93076
  });
92903
93077
  }
92904
93078
  logWithTimestamp(
@@ -94374,7 +94548,7 @@ function bindHermesAttentionRouteIfAvailable(store, input) {
94374
94548
  }
94375
94549
  sessionKeys.add(`backup:${encodeURIComponent(jobId)}`);
94376
94550
  for (const route of envRoutes) {
94377
- persistHermesRouteBinding(store, { jobId, route });
94551
+ persistHermesRouteBinding(store, { jobId, route, sessionAliases: [...sessionKeys] });
94378
94552
  }
94379
94553
  logHermesRouteBinding("hermes_route_bind_success", {
94380
94554
  jobId,
@@ -94559,10 +94733,10 @@ function persistHermesRouteBinding(store, input) {
94559
94733
  store.upsertJobGatewayRoute({
94560
94734
  jobId: input.jobId,
94561
94735
  provider: "hermes",
94562
- route: hermesRouteEntryToGatewayRoute(input.route)
94736
+ route: hermesRouteEntryToGatewayRoute(input.route, input.sessionAliases)
94563
94737
  });
94564
94738
  }
94565
- function hermesRouteEntryToGatewayRoute(route) {
94739
+ function hermesRouteEntryToGatewayRoute(route, sessionAliases = []) {
94566
94740
  return {
94567
94741
  platform: route.platform,
94568
94742
  chatId: route.chat_id,
@@ -94572,7 +94746,12 @@ function hermesRouteEntryToGatewayRoute(route) {
94572
94746
  userId: route.user_id,
94573
94747
  userName: route.user_name,
94574
94748
  sessionKey: route.session_key,
94575
- gatewaySessionKey: route.gateway_session_key
94749
+ gatewaySessionKey: route.gateway_session_key,
94750
+ sessionAliases: [
94751
+ ...new Set(
94752
+ [...route.session_aliases ?? [], ...sessionAliases].map((value) => value.trim()).filter(Boolean)
94753
+ )
94754
+ ]
94576
94755
  };
94577
94756
  }
94578
94757
  function logHermesRouteBinding(event, fields) {
@@ -96180,7 +96359,7 @@ async function getCurrentNodeCliVersion() {
96180
96359
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
96181
96360
  }
96182
96361
  function getBundledNodeCliVersion() {
96183
- return true ? "0.0.22-beta-e1f6d0f26b-260629152447" : null;
96362
+ return true ? "0.1.0" : null;
96184
96363
  }
96185
96364
  function readConfiguredAiProvider() {
96186
96365
  const explicit = process.env.OKX_AGENT_TASK_AI_CLI ?? process.env.OKX_A2A_AI_PROVIDER;
@@ -97023,7 +97202,7 @@ init_sentry_logger();
97023
97202
  init_sentry_config();
97024
97203
  var CURRENT_GATEWAY_SESSION_KEYS_ENV3 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
97025
97204
  function printUsage2() {
97026
- console.log(`okx-a2a ${"0.0.22-beta-e1f6d0f26b-260629152447"}
97205
+ console.log(`okx-a2a ${"0.1.0"}
97027
97206
 
97028
97207
  Usage:
97029
97208
  okx-a2a <command> [options]
@@ -97060,7 +97239,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
97060
97239
  `);
97061
97240
  }
97062
97241
  function printVersion() {
97063
- console.log("0.0.22-beta-e1f6d0f26b-260629152447");
97242
+ console.log("0.1.0");
97064
97243
  }
97065
97244
  function printDaemonUsage() {
97066
97245
  console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
@@ -97092,7 +97271,7 @@ function printTaskUsage() {
97092
97271
  Commands:
97093
97272
  requests [--json] [--timeout-ms <ms>]
97094
97273
  List pending XMTP task requests.
97095
- reject (--job-id <id> | --group-id <id> [--agent-id <id>]) [--json] [--timeout-ms <ms>]
97274
+ reject (--job-id <id> | --group-id <id> [--agent-id <id>]) [--content <text>] [--json] [--timeout-ms <ms>]
97096
97275
  Deny a pending XMTP conversation.
97097
97276
  `);
97098
97277
  }
@@ -97113,6 +97292,7 @@ Options:
97113
97292
  --job-id <id> Deny every pending conversation matching this job id.
97114
97293
  --group-id <id> XMTP group id for the pending conversation.
97115
97294
  --agent-id <id> Agent id whose pending conversation should be denied.
97295
+ --content <text> Send a rejection message to each denied XMTP group before denying it.
97116
97296
  --json Print machine-readable JSON output.
97117
97297
  --timeout-ms <ms> Timeout while waiting for daemon result. Default: 60000.
97118
97298
  `);
@@ -97691,20 +97871,32 @@ function readDenyPendingConversationOptions(args) {
97691
97871
  const jobId = readOption3(args, "--job-id");
97692
97872
  const groupId = readOption3(args, "--group-id");
97693
97873
  const agentId = readOption3(args, "--agent-id");
97874
+ const content3 = readOptionalNonEmptyOption(args, "--content", "task reject --content");
97694
97875
  if (jobId) {
97695
97876
  if (groupId || agentId) {
97696
97877
  throw new Error("task reject --job-id cannot be used with --group-id or --agent-id");
97697
97878
  }
97698
- return { jobId };
97879
+ return { jobId, ...content3 ? { content: content3 } : {} };
97699
97880
  }
97700
97881
  if (!groupId) {
97701
97882
  throw new Error("task reject requires --job-id <id> or --group-id <id>");
97702
97883
  }
97703
97884
  return {
97704
97885
  groupId,
97705
- ...agentId ? { agentId } : {}
97886
+ ...agentId ? { agentId } : {},
97887
+ ...content3 ? { content: content3 } : {}
97706
97888
  };
97707
97889
  }
97890
+ function readOptionalNonEmptyOption(args, name2, label) {
97891
+ if (!hasFlag2(args, name2)) {
97892
+ return void 0;
97893
+ }
97894
+ const value = readOption3(args, name2);
97895
+ if (value === void 0 || value.trim().length === 0) {
97896
+ throw new Error(`${label} requires a non-empty string`);
97897
+ }
97898
+ return value;
97899
+ }
97708
97900
  function outputCommandResult(json, result, human) {
97709
97901
  if (json) {
97710
97902
  console.log(JSON.stringify({
package/dist/index.js CHANGED
@@ -69474,12 +69474,17 @@ function normalizeGatewayRouteInput(value, provider) {
69474
69474
  platform,
69475
69475
  chatId,
69476
69476
  chatName: readText(item.chatName) ?? readText(item.chat_name) ?? "",
69477
- chatType: normalizeGatewayRouteChatType(readText(item.chatType) ?? readText(item.chat_type), parsedRoute?.chatType, threadId),
69477
+ chatType: normalizeGatewayRouteChatType(
69478
+ readText(item.chatType) ?? readText(item.chat_type),
69479
+ parsedRoute?.chatType,
69480
+ threadId
69481
+ ),
69478
69482
  threadId,
69479
69483
  userId: readText(item.userId) ?? readText(item.user_id) ?? "",
69480
69484
  userName: readText(item.userName) ?? readText(item.user_name) ?? "",
69481
69485
  sessionKey,
69482
69486
  gatewaySessionKey,
69487
+ sessionAliases: readTextArray(item.sessionAliases) ?? readTextArray(item.session_aliases) ?? [],
69483
69488
  updatedAt: readText(item.updatedAt) ?? readText(item.updated_at) ?? ""
69484
69489
  };
69485
69490
  }
@@ -69496,15 +69501,26 @@ function normalizeGatewayRoute(route, updatedAt, provider) {
69496
69501
  userName: route.userName ?? "",
69497
69502
  sessionKey: route.sessionKey ?? route.gatewaySessionKey ?? "",
69498
69503
  gatewaySessionKey: route.gatewaySessionKey ?? route.sessionKey ?? "",
69504
+ sessionAliases: normalizeGatewayRouteAliases(route.sessionAliases),
69499
69505
  updatedAt
69500
69506
  };
69501
69507
  }
69502
69508
  function upsertGatewayRoute(routes, route) {
69503
69509
  const key = gatewayRouteKey(route);
69504
69510
  const next = routes.filter((item) => gatewayRouteKey(item) !== key);
69505
- next.push(route);
69511
+ const existing = routes.find((item) => gatewayRouteKey(item) === key);
69512
+ next.push({
69513
+ ...route,
69514
+ sessionAliases: normalizeGatewayRouteAliases([
69515
+ ...existing?.sessionAliases ?? [],
69516
+ ...route.sessionAliases ?? []
69517
+ ])
69518
+ });
69506
69519
  return next;
69507
69520
  }
69521
+ function normalizeGatewayRouteAliases(values) {
69522
+ return [...new Set((values ?? []).map((value) => value.trim()).filter(Boolean))];
69523
+ }
69508
69524
  function gatewayRouteKey(route) {
69509
69525
  return `${route.platform}
69510
69526
  ${route.chatId}
@@ -69606,6 +69622,16 @@ function readText(value) {
69606
69622
  const trimmed = value.trim();
69607
69623
  return trimmed || null;
69608
69624
  }
69625
+ function readTextArray(value) {
69626
+ if (!Array.isArray(value)) {
69627
+ return null;
69628
+ }
69629
+ const values = value.flatMap((item) => {
69630
+ const text = readText(item);
69631
+ return text ? [text] : [];
69632
+ });
69633
+ return normalizeGatewayRouteAliases(values);
69634
+ }
69609
69635
 
69610
69636
  // src/daemon-lock.ts
69611
69637
  var import_promises = require("node:fs/promises");
@@ -74678,6 +74704,7 @@ var CommandStore = class {
74678
74704
  groupId: params.groupId,
74679
74705
  jobId: params.jobId,
74680
74706
  agentId: params.agentId,
74707
+ content: params.content,
74681
74708
  createdAt: Date.now()
74682
74709
  };
74683
74710
  }
@@ -74959,7 +74986,7 @@ function isDaemonCommand(value) {
74959
74986
  }
74960
74987
  if (parsed.type === "xmtp-deny-pending-conversation") {
74961
74988
  const command = parsed;
74962
- return typeof command.groupId === "string" || typeof command.jobId === "string";
74989
+ return (typeof command.groupId === "string" || typeof command.jobId === "string") && (command.content === void 0 || typeof command.content === "string");
74963
74990
  }
74964
74991
  if (parsed.type === "xmtp-refresh-agents") {
74965
74992
  return true;
@@ -75090,8 +75117,9 @@ function loadSqlite3() {
75090
75117
  }
75091
75118
  }
75092
75119
 
75093
- // src/xmtp-send.ts
75094
- var import_node_crypto9 = require("node:crypto");
75120
+ // ../core/src/xmtp-sdk/index.ts
75121
+ var import_node_fs10 = require("node:fs");
75122
+ var import_node_path15 = require("node:path");
75095
75123
 
75096
75124
  // ../../node_modules/@xmtp/content-type-primitives/dist/index.js
75097
75125
  var ContentTypeId = class _ContentTypeId {
@@ -77209,10 +77237,6 @@ var Client = class _Client {
77209
77237
  }
77210
77238
  };
77211
77239
 
77212
- // ../core/src/xmtp-sdk/index.ts
77213
- var import_node_fs10 = require("node:fs");
77214
- var import_node_path15 = require("node:path");
77215
-
77216
77240
  // ../core/src/xmtp-sdk/extract-job-id.ts
77217
77241
  function extractJobIdFromContent(content3) {
77218
77242
  const raw = typeof content3 === "string" ? content3 : JSON.stringify(content3) ?? "";
@@ -85475,6 +85499,9 @@ function buildSendEnvelope(params) {
85475
85499
  return buildA2AEnvelope({ ...params, tips });
85476
85500
  }
85477
85501
 
85502
+ // src/xmtp-send.ts
85503
+ var import_node_crypto9 = require("node:crypto");
85504
+
85478
85505
  // ../core/src/a2a/concurrency.ts
85479
85506
  async function withSharedPromise(registry, key, fn) {
85480
85507
  const existing = registry.get(key);
@@ -86691,7 +86718,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
86691
86718
  client: {
86692
86719
  id: "gateway-client",
86693
86720
  displayName: "okx-a2a-node",
86694
- version: "0.0.22-beta-e1f6d0f26b-260629152447",
86721
+ version: "0.1.0",
86695
86722
  platform: "node",
86696
86723
  mode: "backend",
86697
86724
  instanceId
@@ -86702,7 +86729,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
86702
86729
  commands: [],
86703
86730
  permissions: {},
86704
86731
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
86705
- userAgent: `okx-a2a-node/${"0.0.22-beta-e1f6d0f26b-260629152447"}`,
86732
+ userAgent: `okx-a2a-node/${"0.1.0"}`,
86706
86733
  auth: {
86707
86734
  ...config.token ? { token: config.token } : {},
86708
86735
  ...config.password ? { password: config.password } : {}
@@ -89153,27 +89180,51 @@ async function handleDaemonCommand(command, params) {
89153
89180
  if (command.jobId) {
89154
89181
  return {
89155
89182
  ok: true,
89156
- payload: await denyPendingConversationsByJobId(command.jobId, params)
89183
+ payload: await denyPendingConversationsByJobId(command.jobId, params, command.content)
89157
89184
  };
89158
89185
  }
89159
89186
  if (!command.groupId) {
89160
89187
  throw new Error("xmtp-deny-pending-conversation requires groupId or jobId");
89161
89188
  }
89189
+ const groupId = command.groupId;
89162
89190
  if (command.agentId) {
89163
89191
  const address = params.service.getAddressByAgentId(command.agentId);
89164
89192
  if (!address) {
89165
89193
  throw new Error(`No address found for agentId=${command.agentId}`);
89166
89194
  }
89167
- const denied = await params.service.denyGroup(address, command.groupId);
89168
- return { ok: true, payload: { denied, groupId: command.groupId, agentId: command.agentId, deniedClientCount: denied ? 1 : 0 } };
89169
- }
89170
- const deniedOn = [];
89171
- for (const [address] of params.service.getClients()) {
89172
- if (await params.service.denyGroup(address, command.groupId)) {
89173
- deniedOn.push(address);
89195
+ const targets2 = [{ address, groupId }];
89196
+ if (command.content) {
89197
+ const sendTargets = await resolvePendingTargetsByGroupIdBestEffort(groupId, [address], params);
89198
+ await sendRejectContentToTargets(command.content, sendTargets, params);
89174
89199
  }
89200
+ const results2 = await denyTargets(targets2, params);
89201
+ const deniedOn2 = results2.filter((result) => result.denied).map(({ address: resultAddress, groupId: resultGroupId }) => ({ address: resultAddress, groupId: resultGroupId }));
89202
+ return {
89203
+ ok: true,
89204
+ payload: {
89205
+ denied: deniedOn2.length > 0,
89206
+ groupId,
89207
+ agentId: command.agentId,
89208
+ deniedClientCount: deniedOn2.length
89209
+ }
89210
+ };
89175
89211
  }
89176
- return { ok: true, payload: { denied: deniedOn.length > 0, groupId: command.groupId, deniedClientCount: deniedOn.length, deniedOn } };
89212
+ const targets = [...params.service.getClients().keys()].map((address) => ({ address, groupId }));
89213
+ if (command.content) {
89214
+ const sendTargets = await resolvePendingTargetsByGroupIdBestEffort(groupId, null, params);
89215
+ await sendRejectContentToTargets(command.content, sendTargets, params);
89216
+ }
89217
+ const results = await denyTargets(targets, params);
89218
+ const deniedOn = results.filter((result) => result.denied).map(({ address }) => address);
89219
+ return {
89220
+ ok: true,
89221
+ payload: {
89222
+ denied: deniedOn.length > 0,
89223
+ groupId,
89224
+ deniedClientCount: deniedOn.length,
89225
+ deniedOn
89226
+ }
89227
+ };
89177
89228
  }
89178
89229
  if (command.type === "xmtp-get-conversation-history") {
89179
89230
  const payload = await handleXmtpGetConversationHistory(command, params);
@@ -89198,11 +89249,11 @@ async function listPendingTaskRequests(params) {
89198
89249
  }
89199
89250
  return filterKnownPendingGroups(result, params.sessionStore);
89200
89251
  }
89201
- async function denyPendingConversationsByJobId(jobId, params) {
89252
+ async function denyPendingConversationsByJobId(jobId, params, content3) {
89202
89253
  const pending = await listPendingTaskRequests(params);
89203
89254
  const matched = pending.filter((item) => isPlainObject2(item) && readString2(item.jobId) === jobId);
89204
89255
  const clientAddresses = [...params.service.getClients().keys()];
89205
- const targetsByKey = /* @__PURE__ */ new Map();
89256
+ const targetsByKey = collectDenyTargetsFromPending(matched, clientAddresses);
89206
89257
  const groupIds = /* @__PURE__ */ new Set();
89207
89258
  for (const item of matched) {
89208
89259
  if (!isPlainObject2(item)) {
@@ -89213,19 +89264,12 @@ async function denyPendingConversationsByJobId(jobId, params) {
89213
89264
  continue;
89214
89265
  }
89215
89266
  groupIds.add(groupId);
89216
- const address = readString2(item.myXmtpAddress);
89217
- const addresses = address ? [address] : clientAddresses;
89218
- for (const candidate of addresses) {
89219
- targetsByKey.set(`${candidate}
89220
- ${groupId}`, { address: candidate, groupId });
89221
- }
89222
89267
  }
89223
- const results = await Promise.all(
89224
- [...targetsByKey.values()].map(async (target) => ({
89225
- ...target,
89226
- denied: await params.service.denyGroup(target.address, target.groupId)
89227
- }))
89228
- );
89268
+ const targets = [...targetsByKey.values()];
89269
+ if (content3) {
89270
+ await sendRejectContentToTargets(content3, targets, params);
89271
+ }
89272
+ const results = await denyTargets(targets, params);
89229
89273
  const deniedOn = results.filter((result) => result.denied).map(({ address, groupId }) => ({ address, groupId }));
89230
89274
  return {
89231
89275
  denied: deniedOn.length > 0,
@@ -89236,6 +89280,135 @@ ${groupId}`, { address: candidate, groupId });
89236
89280
  deniedOn
89237
89281
  };
89238
89282
  }
89283
+ function collectDenyTargetsFromPending(pending, fallbackAddresses) {
89284
+ const targetsByKey = /* @__PURE__ */ new Map();
89285
+ for (const item of pending) {
89286
+ if (!isPlainObject2(item)) {
89287
+ continue;
89288
+ }
89289
+ const groupId = readString2(item.groupId);
89290
+ if (!groupId) {
89291
+ continue;
89292
+ }
89293
+ const address = readString2(item.myXmtpAddress);
89294
+ const addresses = address ? [address] : fallbackAddresses;
89295
+ for (const candidate of addresses) {
89296
+ targetsByKey.set(`${candidate}
89297
+ ${groupId}`, {
89298
+ address: candidate,
89299
+ groupId,
89300
+ jobId: readString2(item.jobId),
89301
+ toXmtpAddress: readString2(item.toXmtpAddress),
89302
+ toAgentId: readString2(item.toAgentId)
89303
+ });
89304
+ }
89305
+ }
89306
+ return targetsByKey;
89307
+ }
89308
+ async function resolvePendingTargetsByGroupId(groupId, addresses, params) {
89309
+ const addressSet = addresses ? new Set(addresses) : null;
89310
+ const pending = (await listPendingTaskRequests(params)).filter((item) => {
89311
+ if (!isPlainObject2(item) || readString2(item.groupId) !== groupId) {
89312
+ return false;
89313
+ }
89314
+ const address = readString2(item.myXmtpAddress);
89315
+ return !addressSet || !address || addressSet.has(address);
89316
+ });
89317
+ const targets = [...collectDenyTargetsFromPending(
89318
+ pending,
89319
+ addresses ?? [...params.service.getClients().keys()]
89320
+ ).values()];
89321
+ if (targets.length === 0) {
89322
+ const addressHint = addresses?.length ? ` address=${addresses.join(",")}` : "";
89323
+ throw new Error(`Cannot send task reject content: no pending XMTP group metadata found for groupId=${groupId}${addressHint}`);
89324
+ }
89325
+ return targets;
89326
+ }
89327
+ async function resolvePendingTargetsByGroupIdBestEffort(groupId, addresses, params) {
89328
+ try {
89329
+ return await resolvePendingTargetsByGroupId(groupId, addresses, params);
89330
+ } catch (err2) {
89331
+ reportRejectContentSendFailure(err2, {
89332
+ stage: "resolve-targets",
89333
+ groupId,
89334
+ addresses
89335
+ });
89336
+ return [];
89337
+ }
89338
+ }
89339
+ async function sendRejectContentToTargets(content3, targets, params) {
89340
+ await Promise.all(targets.map(async (target) => {
89341
+ try {
89342
+ await sendRejectContentToTarget(content3, target, params);
89343
+ } catch (err2) {
89344
+ reportRejectContentSendFailure(err2, {
89345
+ stage: "send",
89346
+ groupId: target.groupId,
89347
+ address: target.address,
89348
+ jobId: target.jobId ?? void 0,
89349
+ toAgentId: target.toAgentId ?? void 0,
89350
+ toXmtpAddress: target.toXmtpAddress ?? void 0
89351
+ });
89352
+ }
89353
+ }));
89354
+ }
89355
+ function reportRejectContentSendFailure(err2, context) {
89356
+ const error = err2 instanceof Error ? err2 : new Error(String(err2));
89357
+ logWithTimestamp("[okx-agent-task] task reject content send failed, continuing with deny:", error);
89358
+ logger.error(LogEvent.XMTP_SEND_FAILED, error, {
89359
+ component: "node_command_processor",
89360
+ command: "xmtp-deny-pending-conversation",
89361
+ optional: "true",
89362
+ ...Object.fromEntries(
89363
+ Object.entries(context).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => [key, Array.isArray(value) ? value.join(",") : String(value)])
89364
+ )
89365
+ });
89366
+ }
89367
+ async function sendRejectContentToTarget(content3, target, params) {
89368
+ const jobId = target.jobId;
89369
+ if (!jobId) {
89370
+ throw new Error(`Cannot send task reject content: jobId missing for groupId=${target.groupId} address=${target.address}`);
89371
+ }
89372
+ const receiverAgent = target.toAgentId ? params.service.getAgentByAgentId(target.toAgentId) : void 0;
89373
+ const toXmtpAddress = target.toXmtpAddress ?? receiverAgent?.communicationAddress ?? null;
89374
+ if (!toXmtpAddress) {
89375
+ throw new Error(`Cannot send task reject content: toXmtpAddress missing for groupId=${target.groupId} address=${target.address}`);
89376
+ }
89377
+ const agent = params.service.getClientByAddress(target.address);
89378
+ const conversations = agent?.client?.conversations;
89379
+ if (!conversations) {
89380
+ throw new Error(`No XMTP client found for address=${target.address}`);
89381
+ }
89382
+ const conversation = typeof conversations.getConversationById === "function" ? await conversations.getConversationById(target.groupId) : null;
89383
+ if (!conversation || typeof conversation.send !== "function") {
89384
+ throw new Error(`conversation not found for groupId=${target.groupId} address=${target.address}`);
89385
+ }
89386
+ const senderAgent = params.service.getAgentByAddress(target.address);
89387
+ const rawText = buildSendEnvelope({
89388
+ content: content3,
89389
+ myXmtpAddress: target.address,
89390
+ toXmtpAddress,
89391
+ groupId: target.groupId,
89392
+ jobId,
89393
+ senderAgent,
89394
+ receiverAgentId: receiverAgent?.agentId ?? target.toAgentId ?? null,
89395
+ payload: {
89396
+ taskMinVersion: 1,
89397
+ source: "okx-agent-task",
89398
+ replyToMessageId: null
89399
+ }
89400
+ });
89401
+ logWithTimestamp(`[okx-agent-task] task reject xmtp envelope ${rawText}`);
89402
+ await conversation.send(rawText);
89403
+ }
89404
+ async function denyTargets(targets, params) {
89405
+ return await Promise.all(
89406
+ targets.map(async (target) => ({
89407
+ ...target,
89408
+ denied: await params.service.denyGroup(target.address, target.groupId)
89409
+ }))
89410
+ );
89411
+ }
89239
89412
  function filterKnownPendingGroups(items, sessionStore) {
89240
89413
  if (!sessionStore) {
89241
89414
  return items;
@@ -90975,7 +91148,7 @@ function userWatchEventDeliveredSentryExtra(event) {
90975
91148
  var environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
90976
91149
  var SENTRY_CONFIG = {
90977
91150
  projectName: "okx/openclaw-okx-a2a-extension",
90978
- release: "0.0.22-beta-e1f6d0f26b-260629152447",
91151
+ release: "0.1.0",
90979
91152
  environment
90980
91153
  };
90981
91154
 
@@ -91202,12 +91375,12 @@ async function runListenerWithLock(options, paths) {
91202
91375
  }));
91203
91376
  }
91204
91377
  });
91205
- service.setPluginVersion("0.0.22-beta-e1f6d0f26b-260629152447");
91378
+ service.setPluginVersion("0.1.0");
91206
91379
  await service.init();
91207
91380
  const pluginVersionStatus = service.pluginVersionStatus;
91208
91381
  if (pluginVersionStatus.unavailable) {
91209
91382
  throw new Error(
91210
- `@okxweb3/a2a-node v${"0.0.22-beta-e1f6d0f26b-260629152447"} is below the required minimum v${pluginVersionStatus.minVersion}`
91383
+ `@okxweb3/a2a-node v${"0.1.0"} is below the required minimum v${pluginVersionStatus.minVersion}`
91211
91384
  );
91212
91385
  }
91213
91386
  const systemConfig = service.getSystemConfig();
@@ -91225,7 +91398,7 @@ async function runListenerWithLock(options, paths) {
91225
91398
  onchainosAgentId: "*",
91226
91399
  reason: "system-config missing sentryDsn",
91227
91400
  pluginId: "@okxweb3/a2a-node",
91228
- pluginVersion: "0.0.22-beta-e1f6d0f26b-260629152447"
91401
+ pluginVersion: "0.1.0"
91229
91402
  });
91230
91403
  }
91231
91404
  logWithTimestamp(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okxweb3/a2a-node",
3
- "version": "0.0.22-beta-e1f6d0f26b-260629152447",
3
+ "version": "0.1.0",
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": {