@okxweb3/a2a-node 0.0.4 → 0.0.6-beta-d32218fe3e-260611141219

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 +128 -52
  2. package/dist/index.js +110 -50
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -230,7 +230,7 @@ function assertAiProvider(provider) {
230
230
  }
231
231
  }
232
232
  function isAiProvider(provider) {
233
- return provider === "codex" || provider === "claude" || provider === "openclaw" || provider === "hermes";
233
+ return provider === "codex" || provider === "claude";
234
234
  }
235
235
  function normalizeLimit(limit, fallback) {
236
236
  if (limit === void 0) {
@@ -2170,8 +2170,6 @@ function detectAiProviders(commandExists2 = commandExists, env = process.env) {
2170
2170
  return {
2171
2171
  codex,
2172
2172
  claude,
2173
- openclaw: false,
2174
- hermes: false,
2175
2173
  available: [
2176
2174
  ...codex ? ["codex"] : [],
2177
2175
  ...claude ? ["claude"] : []
@@ -18251,7 +18249,6 @@ var init_sentry_logger = __esm({
18251
18249
  Sentry.captureEvent({
18252
18250
  level: "info",
18253
18251
  message,
18254
- contexts: { report: { info: JSON.stringify(extraWithFlow) } },
18255
18252
  extra: {
18256
18253
  ...extraWithFlow,
18257
18254
  eventName: message
@@ -18275,7 +18272,6 @@ var init_sentry_logger = __esm({
18275
18272
  try {
18276
18273
  Sentry.withScope((scope) => {
18277
18274
  scope.setLevel("error");
18278
- scope.setContext("report", { info: JSON.stringify(extraWithFlow) });
18279
18275
  _SentryLogger.applyDiagnostics(scope, message, extraWithFlow);
18280
18276
  Sentry.captureException(_SentryLogger.createSentryEvent(message), {
18281
18277
  extra: error ? {
@@ -18421,7 +18417,7 @@ var init_sentry_config = __esm({
18421
18417
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
18422
18418
  SENTRY_CONFIG = {
18423
18419
  projectName: "okx/openclaw-okx-a2a-extension",
18424
- release: "0.0.4",
18420
+ release: "0.0.6-beta-d32218fe3e-260611141219",
18425
18421
  environment
18426
18422
  };
18427
18423
  }
@@ -63242,6 +63238,44 @@ var init_dist4 = __esm({
63242
63238
  }
63243
63239
  });
63244
63240
 
63241
+ // ../core/src/xmtp-sdk/extract-job-id.ts
63242
+ function extractJobIdFromContent(content3) {
63243
+ const raw = typeof content3 === "string" ? content3 : JSON.stringify(content3) ?? "";
63244
+ if (!raw) {
63245
+ return "";
63246
+ }
63247
+ let parsed;
63248
+ try {
63249
+ parsed = JSON.parse(raw);
63250
+ } catch {
63251
+ return "";
63252
+ }
63253
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
63254
+ return "";
63255
+ }
63256
+ const payload = parsed;
63257
+ if (typeof payload.jobId === "string" && payload.jobId) {
63258
+ return payload.jobId;
63259
+ }
63260
+ const message = payload.message;
63261
+ if (message && typeof message === "object" && !Array.isArray(message)) {
63262
+ const jobId = message.jobId;
63263
+ if (typeof jobId === "string" && jobId) {
63264
+ return jobId;
63265
+ }
63266
+ }
63267
+ return "";
63268
+ }
63269
+ function jobIdExtras(content3) {
63270
+ const jobId = extractJobIdFromContent(content3);
63271
+ return jobId ? { taskId: jobId } : {};
63272
+ }
63273
+ var init_extract_job_id = __esm({
63274
+ "../core/src/xmtp-sdk/extract-job-id.ts"() {
63275
+ "use strict";
63276
+ }
63277
+ });
63278
+
63245
63279
  // ../core/src/xmtp-sdk/middleware/self-filter.ts
63246
63280
  function selfFilterMiddleware() {
63247
63281
  return async (ctx, next) => {
@@ -63270,9 +63304,11 @@ function loggingMiddleware(identity3) {
63270
63304
  const contentSummary = summarizeMessageContent(msg.content);
63271
63305
  const baseExtras = {
63272
63306
  ...agentExtras(identity3),
63307
+ ...jobIdExtras(msg.content),
63273
63308
  peerInboxId: msg.senderInboxId,
63274
63309
  conversationId,
63275
- messageId: msg.id
63310
+ messageId: msg.id,
63311
+ stage: "inbound/transport_received"
63276
63312
  };
63277
63313
  if (conv instanceof Group) {
63278
63314
  const groupName = conv.name ?? "unnamed";
@@ -63354,6 +63390,7 @@ var init_logging = __esm({
63354
63390
  "use strict";
63355
63391
  init_dist4();
63356
63392
  init_sentry_logger();
63393
+ init_extract_job_id();
63357
63394
  }
63358
63395
  });
63359
63396
 
@@ -77173,6 +77210,35 @@ var init_installation_prune = __esm({
77173
77210
  }
77174
77211
  });
77175
77212
 
77213
+ // ../core/src/xmtp-sdk/onchainos/agent-status.ts
77214
+ function isAgentXmtpCommunicable(agent) {
77215
+ if (!agent) {
77216
+ return false;
77217
+ }
77218
+ return XMTP_COMMUNICABLE_AGENT_STATUSES.has(Number(agent.status));
77219
+ }
77220
+ function isAgentXmtpBlocked(agent) {
77221
+ if (!agent) {
77222
+ return false;
77223
+ }
77224
+ return XMTP_BLOCKED_AGENT_STATUSES.has(Number(agent.status));
77225
+ }
77226
+ var XMTP_COMMUNICABLE_AGENT_STATUSES, XMTP_BLOCKED_AGENT_STATUSES;
77227
+ var init_agent_status = __esm({
77228
+ "../core/src/xmtp-sdk/onchainos/agent-status.ts"() {
77229
+ "use strict";
77230
+ XMTP_COMMUNICABLE_AGENT_STATUSES = /* @__PURE__ */ new Set([
77231
+ 1 /* ACTIVE */,
77232
+ 2 /* USER_OFFLINE */
77233
+ ]);
77234
+ XMTP_BLOCKED_AGENT_STATUSES = /* @__PURE__ */ new Set([
77235
+ 3 /* SECURITY_BLACKLISTED */,
77236
+ 4 /* RISK_BLACKLISTED */,
77237
+ 5 /* MANUALLY_BLACKLISTED */
77238
+ ]);
77239
+ }
77240
+ });
77241
+
77176
77242
  // ../core/src/xmtp-sdk/index.ts
77177
77243
  function cachePath(dataDir, fileName) {
77178
77244
  return (0, import_node_path11.join)(dataDir, fileName);
@@ -77514,7 +77580,7 @@ function parseGroupPayload(content3) {
77514
77580
  }
77515
77581
  }
77516
77582
  function isAgentUnavailable(agent) {
77517
- return !!agent && AGENT_UNAVAILABLE_STATUSES.has(Number(agent.status));
77583
+ return isAgentXmtpBlocked(agent);
77518
77584
  }
77519
77585
  function createOfflineReplayAddressSummary(address) {
77520
77586
  return {
@@ -77533,7 +77599,7 @@ function createOfflineReplayAddressSummary(address) {
77533
77599
  durationMs: 0
77534
77600
  };
77535
77601
  }
77536
- var import_node_fs8, import_node_path11, DEFAULT_DATA_DIR, SENSITIVE_WORDS_LAZY_RETRY_COOLDOWN_MS, SESSION_EXPIRED_RE, SYSTEM_CONFIG_DEFAULTS, SEMVER_RE, AGENT_UNAVAILABLE_STATUSES, SENDER_BLACKLISTED_MESSAGE, RECIPIENT_BLACKLISTED_MESSAGE, XmtpService;
77602
+ var import_node_fs8, import_node_path11, DEFAULT_DATA_DIR, SENSITIVE_WORDS_LAZY_RETRY_COOLDOWN_MS, SESSION_EXPIRED_RE, SYSTEM_CONFIG_DEFAULTS, SEMVER_RE, SENDER_BLACKLISTED_MESSAGE, RECIPIENT_BLACKLISTED_MESSAGE, XmtpService;
77537
77603
  var init_xmtp_sdk = __esm({
77538
77604
  "../core/src/xmtp-sdk/index.ts"() {
77539
77605
  "use strict";
@@ -77541,12 +77607,14 @@ var init_xmtp_sdk = __esm({
77541
77607
  import_node_path11 = require("node:path");
77542
77608
  init_dist4();
77543
77609
  init_sentry_logger();
77610
+ init_extract_job_id();
77544
77611
  init_self_filter();
77545
77612
  init_logging();
77546
77613
  init_sensitive_word();
77547
77614
  init_concurrency();
77548
77615
  init_a2a_paths();
77549
77616
  init_installation_prune();
77617
+ init_agent_status();
77550
77618
  DEFAULT_DATA_DIR = resolveA2aTaskPaths().xmtpDir;
77551
77619
  SENSITIVE_WORDS_LAZY_RETRY_COOLDOWN_MS = 10 * 60 * 1e3;
77552
77620
  SESSION_EXPIRED_RE = /session expired/i;
@@ -77561,7 +77629,6 @@ var init_xmtp_sdk = __esm({
77561
77629
  }
77562
77630
  };
77563
77631
  SEMVER_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;
77564
- AGENT_UNAVAILABLE_STATUSES = /* @__PURE__ */ new Set([2, 3, 4]);
77565
77632
  SENDER_BLACKLISTED_MESSAGE = "SENDER_BLACKLISTED: Your agent has been blacklisted or delisted\nand cannot initiate A2A communication. Please contact the official support\nteam at https://web3.okx.com/zh-hans/help to review your status, or register\na new agent to resume communication.";
77566
77633
  RECIPIENT_BLACKLISTED_MESSAGE = "RECIPIENT_BLACKLISTED: The target agent has been blacklisted or\ndelisted and can no longer receive messages. Please switch to a different\nagent to continue this conversation.";
77567
77634
  XmtpService = class _XmtpService {
@@ -78410,7 +78477,6 @@ var init_xmtp_sdk = __esm({
78410
78477
  toXmtpAddress: metaPayload.fromXmtpAddress ?? peerMsgs[0].senderInboxId,
78411
78478
  toAgentId: metaPayload.sender?.agentId ?? null,
78412
78479
  jobId: metaPayload.jobId,
78413
- securityRate: typeof metaPayload.sender?.securityRate === "number" ? metaPayload.sender.securityRate : 0,
78414
78480
  messages: chatMsgs
78415
78481
  });
78416
78482
  } catch (err2) {
@@ -78430,7 +78496,6 @@ var init_xmtp_sdk = __esm({
78430
78496
  );
78431
78497
  }
78432
78498
  }
78433
- result.sort((a, b) => b.securityRate - a.securityRate);
78434
78499
  return result;
78435
78500
  }
78436
78501
  async denyGroup(myXmtpAddress, groupId) {
@@ -78741,8 +78806,10 @@ var init_xmtp_sdk = __esm({
78741
78806
  inboxId: agent.client?.inboxId,
78742
78807
  onchainosAgentId: this.getAgentByAddress(address)?.agentId
78743
78808
  }),
78809
+ ...jobIdExtras(msg.content),
78744
78810
  messageId: msg.id,
78745
- conversationId: conv.id
78811
+ conversationId: conv.id,
78812
+ stage: "offlineReplay/handleMessage"
78746
78813
  });
78747
78814
  } else {
78748
78815
  summary.skipped++;
@@ -78754,8 +78821,11 @@ var init_xmtp_sdk = __esm({
78754
78821
  err2 instanceof Error ? err2 : void 0,
78755
78822
  {
78756
78823
  walletAddress: address,
78824
+ ...jobIdExtras(msg.content),
78757
78825
  messageId: msg.id,
78758
- conversationId: conv.id
78826
+ conversationId: conv.id,
78827
+ stage: "offlineReplay/handleMessage",
78828
+ reason: err2 instanceof Error ? err2.name : "unknown_error"
78759
78829
  }
78760
78830
  );
78761
78831
  } finally {
@@ -78774,6 +78844,8 @@ var init_xmtp_sdk = __esm({
78774
78844
  err2 instanceof Error ? err2 : void 0,
78775
78845
  {
78776
78846
  walletAddress: address,
78847
+ stage: "offlineReplay/readConversation",
78848
+ reason: err2 instanceof Error ? err2.name : "unknown_error",
78777
78849
  conversationId: conv.id
78778
78850
  }
78779
78851
  );
@@ -79079,7 +79151,7 @@ async function listAllAgentsWithMetadata(previousFingerprint) {
79079
79151
  }
79080
79152
  page++;
79081
79153
  }
79082
- const active = agents.filter((a) => a.status === 1 /* ACTIVE */);
79154
+ const active = agents.filter(isAgentXmtpCommunicable);
79083
79155
  const fingerprint = fingerprintAgents(active);
79084
79156
  const changed = previousFingerprint === void 0 || previousFingerprint !== fingerprint;
79085
79157
  const stderrLines = stderrs.map(filterNoisyAgentIdentityLog).filter((line) => line.length > 0);
@@ -79185,7 +79257,7 @@ async function checkMessageEligible(params) {
79185
79257
  ]));
79186
79258
  } catch (err2) {
79187
79259
  guardCatchSessionExpired(err2, "message-eligible");
79188
- return { eligible: false, reason: "message-eligible-cli-error" };
79260
+ throw new Error("message-eligible-cli-error", { cause: err2 });
79189
79261
  }
79190
79262
  if (stderr) {
79191
79263
  console.log(`[onchainos] stderr (message-eligible): ${stderr}`);
@@ -79203,13 +79275,13 @@ async function checkMessageEligible(params) {
79203
79275
  direction: params.direction,
79204
79276
  providerSecurityRate: String(params.providerSecurityRate)
79205
79277
  });
79206
- } catch {
79207
- return { eligible: false, reason: "message-eligible-json-parse-failed" };
79278
+ } catch (err2) {
79279
+ throw new Error("message-eligible-json-parse-failed", { cause: err2 });
79208
79280
  }
79209
79281
  if (!res.ok) {
79210
79282
  guardSessionExpired(stdout, "message-eligible");
79211
79283
  console.warn(
79212
- `[onchainos] message-eligible ok=false, blocking message: ${stdout.slice(0, 200)}`
79284
+ `[onchainos] message-eligible ok=false: ${stdout.slice(0, 200)}`
79213
79285
  );
79214
79286
  logger.error(
79215
79287
  LogEvent.ONCHAINOS_CLI_ERROR,
@@ -79228,7 +79300,7 @@ async function checkMessageEligible(params) {
79228
79300
  reason: "ok=false"
79229
79301
  })
79230
79302
  );
79231
- return { eligible: false, reason: "message-eligible-ok-false" };
79303
+ throw new Error("message-eligible-ok-false");
79232
79304
  }
79233
79305
  console.log(
79234
79306
  `[onchainos] message-eligible result: eligible=${res.data.eligible}`
@@ -79315,6 +79387,8 @@ var init_onchainos = __esm({
79315
79387
  init_bin();
79316
79388
  init_sentry_logger();
79317
79389
  init_xmtp_sdk();
79390
+ init_agent_status();
79391
+ init_agent_status();
79318
79392
  CliErrorReason = {
79319
79393
  OK_FALSE: "ok_false",
79320
79394
  JSON_PARSE_FAILED: "json_parse_failed"
@@ -79433,17 +79507,16 @@ function buildA2AEnvelope(params) {
79433
79507
  toXmtpAddress: params.toXmtpAddress,
79434
79508
  groupId: params.groupId,
79435
79509
  jobId: params.jobId,
79436
- sender: params.senderAgent ? { agentId: params.senderAgent.agentId, name: params.senderAgent.name, profileDescription: params.senderAgent.profileDescription, profilePicture: params.senderAgent.profilePicture, role: params.senderAgent.role, securityRate: params.senderAgent.securityRate } : null,
79510
+ sender: params.senderAgent ? { agentId: params.senderAgent.agentId, name: params.senderAgent.name, role: params.senderAgent.role } : null,
79437
79511
  receiverAgentId: params.receiverAgentId ?? null
79438
79512
  };
79439
79513
  if (isNonEmptyPlainObject(params.payload)) {
79440
79514
  envelope.payload = params.payload;
79441
79515
  }
79442
- envelope.scheme = A2A_MSG_SCHEME;
79443
79516
  envelope.tips = isNonEmptyPlainObject(params.tips) ? params.tips : DEFAULT_A2A_TIPS;
79444
79517
  return JSON.stringify(envelope, null, 2);
79445
79518
  }
79446
- var DEFAULT_A2A_TIPS, A2A_MSG_SCHEME;
79519
+ var DEFAULT_A2A_TIPS;
79447
79520
  var init_envelope_shared = __esm({
79448
79521
  "../core/src/a2a/envelope.shared.ts"() {
79449
79522
  "use strict";
@@ -79451,18 +79524,6 @@ var init_envelope_shared = __esm({
79451
79524
  DEFAULT_A2A_TIPS = {
79452
79525
  "task-skill": "Read the okx-agent-task skill if you don't know the context"
79453
79526
  };
79454
- A2A_MSG_SCHEME = {
79455
- msgType: `Message type identifier, fixed to "${A2A_MESSAGE_TYPE}"`,
79456
- content: "Message body",
79457
- contentType: 'Content type, fixed to "text"',
79458
- fromXmtpAddress: "Sender's XMTP address",
79459
- toXmtpAddress: "Receiver's XMTP address",
79460
- groupId: "XMTP group chat ID",
79461
- jobId: "A2A job ID",
79462
- sender: "Sender's agent identity, includes agentId / name / profileDescription / profilePicture / role / securityRate",
79463
- receiverAgentId: "Receiver's onchainos agentId (null if unknown)",
79464
- payload: "Optional extra data attached by the sender for the receiver; absent when the sender did not provide any"
79465
- };
79466
79527
  }
79467
79528
  });
79468
79529
 
@@ -80028,10 +80089,10 @@ async function assertOutboundEligible(params) {
80028
80089
  });
80029
80090
  } catch (err2) {
80030
80091
  console.log(
80031
- `[okx-agent-task] outbound message-eligible call failed, blocking send: senderAgentId=${senderAgent.agentId} receiverAgentId=${receiverAgent.agentId} job=${jobId} group=${groupId}`,
80092
+ `[okx-agent-task] outbound message-eligible call failed, letting send continue: senderAgentId=${senderAgent.agentId} receiverAgentId=${receiverAgent.agentId} job=${jobId} group=${groupId}`,
80032
80093
  err2
80033
80094
  );
80034
- throw new Error("unable to verify message eligibility for this task/group");
80095
+ return;
80035
80096
  }
80036
80097
  console.log(
80037
80098
  `[okx-agent-task] outbound message-eligible: senderAgentId=${senderAgent.agentId} receiverAgentId=${receiverAgent.agentId} job=${jobId} group=${groupId} result=${JSON.stringify(result)}`
@@ -80732,7 +80793,8 @@ function buildAiAdapterCommand(options) {
80732
80793
  args: options.sessionId ? [...prefix, "resume", "--json", "--skip-git-repo-check", options.sessionId, options.prompt] : [...prefix, "--json", "--skip-git-repo-check", options.prompt]
80733
80794
  };
80734
80795
  }
80735
- if (options.provider === "openclaw") {
80796
+ const dormantProvider = options.provider;
80797
+ if (dormantProvider === "openclaw") {
80736
80798
  const agentId = env.OKX_A2A_AI_OPENCLAW_AGENT_ID || "okx-a2a";
80737
80799
  const sessionArgs = options.sessionId ? ["--session-id", options.sessionId] : options.sessionKey ? ["--session-key", formatOpenClawSessionKey(options.sessionKey, agentId)] : [];
80738
80800
  return {
@@ -80741,7 +80803,7 @@ function buildAiAdapterCommand(options) {
80741
80803
  args: ["agent", ...sessionArgs, "--message", options.prompt, "--json"]
80742
80804
  };
80743
80805
  }
80744
- if (options.provider === "hermes") {
80806
+ if (dormantProvider === "hermes") {
80745
80807
  return {
80746
80808
  provider: options.provider,
80747
80809
  command,
@@ -83910,7 +83972,8 @@ async function isTrustedDmSender(params) {
83910
83972
  peerInboxId: senderInboxId,
83911
83973
  messageId,
83912
83974
  conversationId,
83913
- chatType: "dm"
83975
+ chatType: "dm",
83976
+ stage: "inbound/dm_trust_check"
83914
83977
  });
83915
83978
  const matches = (ids) => {
83916
83979
  if (ids.length === 0) {
@@ -83925,11 +83988,11 @@ async function isTrustedDmSender(params) {
83925
83988
  trustedInboxIds = svc.getTrustedDmInboxIds();
83926
83989
  }
83927
83990
  if (trustedInboxIds.length === 0) {
83928
- logger.info(LogEvent.DM_WHITELIST_FAIL_OPEN, dmExtras());
83991
+ logger.info(LogEvent.DM_WHITELIST_FAIL_OPEN, { ...dmExtras(), reason: "trusted_inbox_list_empty" });
83929
83992
  return true;
83930
83993
  }
83931
83994
  if (!matches(trustedInboxIds)) {
83932
- logger.info(LogEvent.INBOUND_DROP_DM_NON_SYSTEM, dmExtras());
83995
+ logger.info(LogEvent.INBOUND_DROP_DM_NON_SYSTEM, { ...dmExtras(), reason: "sender_not_in_system_whitelist" });
83933
83996
  console.log(
83934
83997
  `[okx-agent-task:${myXmtpAddress}] DM sender not in system whitelist, dropping: senderInboxId=${senderInboxId || "(empty)"}`
83935
83998
  );
@@ -83976,7 +84039,9 @@ async function claimedAddressMatchesSender(params) {
83976
84039
  peerInboxId: senderInboxId,
83977
84040
  taskId: "",
83978
84041
  conversationId,
83979
- messageId
84042
+ messageId,
84043
+ stage: "inbound/address_check",
84044
+ reason: err2 instanceof Error ? err2.name : "unknown_error"
83980
84045
  }
83981
84046
  );
83982
84047
  return false;
@@ -84025,6 +84090,7 @@ async function verifyInboundA2AGroupMessage(params) {
84025
84090
  conversationId: groupId,
84026
84091
  messageId,
84027
84092
  action: "auto-deny",
84093
+ stage: "inbound/address_check",
84028
84094
  reason: "claimed-address-mismatch"
84029
84095
  });
84030
84096
  }
@@ -84040,6 +84106,8 @@ async function verifyInboundA2AGroupMessage(params) {
84040
84106
  conversationId: groupId,
84041
84107
  messageId,
84042
84108
  consentState: String(consentState ?? ""),
84109
+ stage: "inbound/address_check",
84110
+ reason: "claimed_address_mismatch",
84043
84111
  action: autoDenyAttempted ? "auto-deny" : "drop",
84044
84112
  autoDenyAttempted: String(autoDenyAttempted),
84045
84113
  autoDenySucceeded: String(autoDenySucceeded),
@@ -84054,7 +84122,7 @@ async function verifyInboundA2AGroupMessage(params) {
84054
84122
  return true;
84055
84123
  }
84056
84124
  const isSenderClient = senderRole === 1 /* CLIENT */;
84057
- const providerSecurityRate = (isSenderClient ? myAgent.securityRate : readNumber(sender?.securityRate)) ?? 0;
84125
+ const providerSecurityRate = (isSenderClient ? myAgent.securityRate : service.getAgentStatusByAgentId(senderAgentId)?.securityRate) ?? 0;
84058
84126
  try {
84059
84127
  const result = await checkMessageEligible({
84060
84128
  agentId: myAgent.agentId,
@@ -84084,16 +84152,17 @@ async function verifyInboundA2AGroupMessage(params) {
84084
84152
  messageId,
84085
84153
  direction: isSenderClient ? "client_to_provider" : "provider_to_client",
84086
84154
  providerSecurityRate: String(providerSecurityRate),
84155
+ stage: "inbound/eligibility_check",
84087
84156
  reason: result.reason ?? ""
84088
84157
  });
84089
84158
  return false;
84090
84159
  }
84091
84160
  } catch (err2) {
84092
84161
  console.log(
84093
- `[okx-agent-task:${myXmtpAddress}] message-eligible call failed, dropping:`,
84162
+ `[okx-agent-task:${myXmtpAddress}] message-eligible call failed, letting message through:`,
84094
84163
  err2
84095
84164
  );
84096
- logger.info(LogEvent.INBOUND_BLOCKED_INELIGIBLE, {
84165
+ logger.error(LogEvent.INBOUND_ELIGIBILITY_BYPASSED, err2 instanceof Error ? err2 : new Error(String(err2)), {
84097
84166
  ...agentExtras({ walletAddress: myXmtpAddress, onchainosAgentId: myAgent.agentId }),
84098
84167
  peerWalletAddress: senderAddress,
84099
84168
  peerInboxId: senderInboxId,
@@ -84103,9 +84172,10 @@ async function verifyInboundA2AGroupMessage(params) {
84103
84172
  messageId,
84104
84173
  direction: isSenderClient ? "client_to_provider" : "provider_to_client",
84105
84174
  providerSecurityRate: String(providerSecurityRate),
84175
+ stage: "inbound/eligibility_check",
84106
84176
  reason: "exception"
84107
84177
  });
84108
- return false;
84178
+ return true;
84109
84179
  }
84110
84180
  return true;
84111
84181
  }
@@ -84139,7 +84209,9 @@ async function processFileMessage(ctx, deps, options = {}) {
84139
84209
  {
84140
84210
  ...agentExtras({ walletAddress: deps.myXmtpAddress }),
84141
84211
  taskId: systemNotification.jobId ?? "",
84142
- messageId: systemMessageId
84212
+ messageId: systemMessageId,
84213
+ stage: "inbound/payload_parse",
84214
+ reason: "system_dm_missing_agent_id"
84143
84215
  }
84144
84216
  );
84145
84217
  }
@@ -84202,7 +84274,9 @@ async function processFileMessage(ctx, deps, options = {}) {
84202
84274
  messageId,
84203
84275
  chatType: "group",
84204
84276
  msgType: readString2(payloadObject?.msgType) ?? "",
84205
- msgTypeType: typeof payloadObject?.msgType
84277
+ msgTypeType: typeof payloadObject?.msgType,
84278
+ stage: "inbound/payload_parse",
84279
+ reason: "unsupported_msg_type"
84206
84280
  });
84207
84281
  return true;
84208
84282
  }
@@ -84634,12 +84708,12 @@ async function runListenerWithLock(options, paths) {
84634
84708
  }));
84635
84709
  }
84636
84710
  });
84637
- service.setPluginVersion("0.0.4");
84711
+ service.setPluginVersion("0.0.6-beta-d32218fe3e-260611141219");
84638
84712
  await service.init();
84639
84713
  const pluginVersionStatus = service.pluginVersionStatus;
84640
84714
  if (pluginVersionStatus.unavailable) {
84641
84715
  throw new Error(
84642
- `@okxweb3/a2a-node v${"0.0.4"} is below the required minimum v${pluginVersionStatus.minVersion}`
84716
+ `@okxweb3/a2a-node v${"0.0.6-beta-d32218fe3e-260611141219"} is below the required minimum v${pluginVersionStatus.minVersion}`
84643
84717
  );
84644
84718
  }
84645
84719
  const systemConfig = service.getSystemConfig();
@@ -84657,7 +84731,7 @@ async function runListenerWithLock(options, paths) {
84657
84731
  onchainosAgentId: "*",
84658
84732
  reason: "system-config missing sentryDsn",
84659
84733
  pluginId: "@okxweb3/a2a-node",
84660
- pluginVersion: "0.0.4"
84734
+ pluginVersion: "0.0.6-beta-d32218fe3e-260611141219"
84661
84735
  });
84662
84736
  }
84663
84737
  console.log(
@@ -84690,6 +84764,7 @@ async function runListenerWithLock(options, paths) {
84690
84764
  logger.error(LogEvent.HEARTBEAT_FAILED, heartbeatResult.error instanceof Error ? heartbeatResult.error : new Error(String(heartbeatResult.error)), {
84691
84765
  component: "node_listener",
84692
84766
  stage: "sync_tick",
84767
+ reason: heartbeatResult.error instanceof Error ? heartbeatResult.error.name : "unknown_error",
84693
84768
  durationMs: String(heartbeatMs),
84694
84769
  chainIndex: ONCHAINOS_CHAIN_INDEX,
84695
84770
  communicationClass: "onchainos_or_network"
@@ -84700,6 +84775,7 @@ async function runListenerWithLock(options, paths) {
84700
84775
  logger.error(LogEvent.OFFLINE_REPLAY_FAILED, replayResult.error instanceof Error ? replayResult.error : new Error(String(replayResult.error)), {
84701
84776
  component: "node_listener",
84702
84777
  stage: "sync_tick",
84778
+ reason: replayResult.error instanceof Error ? replayResult.error.name : "unknown_error",
84703
84779
  durationMs: String(replayMs),
84704
84780
  communicationClass: "xmtp_replay_or_storage"
84705
84781
  });
package/dist/index.js CHANGED
@@ -65259,7 +65259,7 @@ function assertAiProvider(provider) {
65259
65259
  }
65260
65260
  }
65261
65261
  function isAiProvider(provider) {
65262
- return provider === "codex" || provider === "claude" || provider === "openclaw" || provider === "hermes";
65262
+ return provider === "codex" || provider === "claude";
65263
65263
  }
65264
65264
  function normalizeLimit(limit, fallback) {
65265
65265
  if (limit === void 0) {
@@ -66120,8 +66120,6 @@ function detectAiProviders(commandExists2 = commandExists, env = process.env) {
66120
66120
  return {
66121
66121
  codex,
66122
66122
  claude,
66123
- openclaw: false,
66124
- hermes: false,
66125
66123
  available: [
66126
66124
  ...codex ? ["codex"] : [],
66127
66125
  ...claude ? ["claude"] : []
@@ -66937,7 +66935,6 @@ var SentryLogger = class _SentryLogger {
66937
66935
  Sentry.captureEvent({
66938
66936
  level: "info",
66939
66937
  message,
66940
- contexts: { report: { info: JSON.stringify(extraWithFlow) } },
66941
66938
  extra: {
66942
66939
  ...extraWithFlow,
66943
66940
  eventName: message
@@ -66961,7 +66958,6 @@ var SentryLogger = class _SentryLogger {
66961
66958
  try {
66962
66959
  Sentry.withScope((scope) => {
66963
66960
  scope.setLevel("error");
66964
- scope.setContext("report", { info: JSON.stringify(extraWithFlow) });
66965
66961
  _SentryLogger.applyDiagnostics(scope, message, extraWithFlow);
66966
66962
  Sentry.captureException(_SentryLogger.createSentryEvent(message), {
66967
66963
  extra: error ? {
@@ -67177,7 +67173,8 @@ function buildAiAdapterCommand(options) {
67177
67173
  args: options.sessionId ? [...prefix, "resume", "--json", "--skip-git-repo-check", options.sessionId, options.prompt] : [...prefix, "--json", "--skip-git-repo-check", options.prompt]
67178
67174
  };
67179
67175
  }
67180
- if (options.provider === "openclaw") {
67176
+ const dormantProvider = options.provider;
67177
+ if (dormantProvider === "openclaw") {
67181
67178
  const agentId = env.OKX_A2A_AI_OPENCLAW_AGENT_ID || "okx-a2a";
67182
67179
  const sessionArgs = options.sessionId ? ["--session-id", options.sessionId] : options.sessionKey ? ["--session-key", formatOpenClawSessionKey(options.sessionKey, agentId)] : [];
67183
67180
  return {
@@ -67186,7 +67183,7 @@ function buildAiAdapterCommand(options) {
67186
67183
  args: ["agent", ...sessionArgs, "--message", options.prompt, "--json"]
67187
67184
  };
67188
67185
  }
67189
- if (options.provider === "hermes") {
67186
+ if (dormantProvider === "hermes") {
67190
67187
  return {
67191
67188
  provider: options.provider,
67192
67189
  command,
@@ -72140,6 +72137,39 @@ var Client = class _Client {
72140
72137
  var import_node_fs9 = require("node:fs");
72141
72138
  var import_node_path14 = require("node:path");
72142
72139
 
72140
+ // ../core/src/xmtp-sdk/extract-job-id.ts
72141
+ function extractJobIdFromContent(content3) {
72142
+ const raw = typeof content3 === "string" ? content3 : JSON.stringify(content3) ?? "";
72143
+ if (!raw) {
72144
+ return "";
72145
+ }
72146
+ let parsed;
72147
+ try {
72148
+ parsed = JSON.parse(raw);
72149
+ } catch {
72150
+ return "";
72151
+ }
72152
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
72153
+ return "";
72154
+ }
72155
+ const payload = parsed;
72156
+ if (typeof payload.jobId === "string" && payload.jobId) {
72157
+ return payload.jobId;
72158
+ }
72159
+ const message = payload.message;
72160
+ if (message && typeof message === "object" && !Array.isArray(message)) {
72161
+ const jobId = message.jobId;
72162
+ if (typeof jobId === "string" && jobId) {
72163
+ return jobId;
72164
+ }
72165
+ }
72166
+ return "";
72167
+ }
72168
+ function jobIdExtras(content3) {
72169
+ const jobId = extractJobIdFromContent(content3);
72170
+ return jobId ? { taskId: jobId } : {};
72171
+ }
72172
+
72143
72173
  // ../core/src/xmtp-sdk/middleware/self-filter.ts
72144
72174
  function selfFilterMiddleware() {
72145
72175
  return async (ctx, next) => {
@@ -72163,9 +72193,11 @@ function loggingMiddleware(identity3) {
72163
72193
  const contentSummary = summarizeMessageContent(msg.content);
72164
72194
  const baseExtras = {
72165
72195
  ...agentExtras(identity3),
72196
+ ...jobIdExtras(msg.content),
72166
72197
  peerInboxId: msg.senderInboxId,
72167
72198
  conversationId,
72168
- messageId: msg.id
72199
+ messageId: msg.id,
72200
+ stage: "inbound/transport_received"
72169
72201
  };
72170
72202
  if (conv instanceof Group) {
72171
72203
  const groupName = conv.name ?? "unnamed";
@@ -78520,6 +78552,29 @@ function compareTimestamp(a, b) {
78520
78552
  return 0;
78521
78553
  }
78522
78554
 
78555
+ // ../core/src/xmtp-sdk/onchainos/agent-status.ts
78556
+ var XMTP_COMMUNICABLE_AGENT_STATUSES = /* @__PURE__ */ new Set([
78557
+ 1 /* ACTIVE */,
78558
+ 2 /* USER_OFFLINE */
78559
+ ]);
78560
+ var XMTP_BLOCKED_AGENT_STATUSES = /* @__PURE__ */ new Set([
78561
+ 3 /* SECURITY_BLACKLISTED */,
78562
+ 4 /* RISK_BLACKLISTED */,
78563
+ 5 /* MANUALLY_BLACKLISTED */
78564
+ ]);
78565
+ function isAgentXmtpCommunicable(agent) {
78566
+ if (!agent) {
78567
+ return false;
78568
+ }
78569
+ return XMTP_COMMUNICABLE_AGENT_STATUSES.has(Number(agent.status));
78570
+ }
78571
+ function isAgentXmtpBlocked(agent) {
78572
+ if (!agent) {
78573
+ return false;
78574
+ }
78575
+ return XMTP_BLOCKED_AGENT_STATUSES.has(Number(agent.status));
78576
+ }
78577
+
78523
78578
  // ../core/src/xmtp-sdk/index.ts
78524
78579
  var DEFAULT_DATA_DIR = resolveA2aTaskPaths().xmtpDir;
78525
78580
  function cachePath(dataDir, fileName) {
@@ -78868,11 +78923,10 @@ function parseGroupPayload(content3) {
78868
78923
  return null;
78869
78924
  }
78870
78925
  }
78871
- var AGENT_UNAVAILABLE_STATUSES = /* @__PURE__ */ new Set([2, 3, 4]);
78872
78926
  var SENDER_BLACKLISTED_MESSAGE = "SENDER_BLACKLISTED: Your agent has been blacklisted or delisted\nand cannot initiate A2A communication. Please contact the official support\nteam at https://web3.okx.com/zh-hans/help to review your status, or register\na new agent to resume communication.";
78873
78927
  var RECIPIENT_BLACKLISTED_MESSAGE = "RECIPIENT_BLACKLISTED: The target agent has been blacklisted or\ndelisted and can no longer receive messages. Please switch to a different\nagent to continue this conversation.";
78874
78928
  function isAgentUnavailable(agent) {
78875
- return !!agent && AGENT_UNAVAILABLE_STATUSES.has(Number(agent.status));
78929
+ return isAgentXmtpBlocked(agent);
78876
78930
  }
78877
78931
  var XmtpService = class _XmtpService {
78878
78932
  static instance = null;
@@ -79720,7 +79774,6 @@ var XmtpService = class _XmtpService {
79720
79774
  toXmtpAddress: metaPayload.fromXmtpAddress ?? peerMsgs[0].senderInboxId,
79721
79775
  toAgentId: metaPayload.sender?.agentId ?? null,
79722
79776
  jobId: metaPayload.jobId,
79723
- securityRate: typeof metaPayload.sender?.securityRate === "number" ? metaPayload.sender.securityRate : 0,
79724
79777
  messages: chatMsgs
79725
79778
  });
79726
79779
  } catch (err2) {
@@ -79740,7 +79793,6 @@ var XmtpService = class _XmtpService {
79740
79793
  );
79741
79794
  }
79742
79795
  }
79743
- result.sort((a, b) => b.securityRate - a.securityRate);
79744
79796
  return result;
79745
79797
  }
79746
79798
  async denyGroup(myXmtpAddress, groupId) {
@@ -80051,8 +80103,10 @@ var XmtpService = class _XmtpService {
80051
80103
  inboxId: agent.client?.inboxId,
80052
80104
  onchainosAgentId: this.getAgentByAddress(address)?.agentId
80053
80105
  }),
80106
+ ...jobIdExtras(msg.content),
80054
80107
  messageId: msg.id,
80055
- conversationId: conv.id
80108
+ conversationId: conv.id,
80109
+ stage: "offlineReplay/handleMessage"
80056
80110
  });
80057
80111
  } else {
80058
80112
  summary.skipped++;
@@ -80064,8 +80118,11 @@ var XmtpService = class _XmtpService {
80064
80118
  err2 instanceof Error ? err2 : void 0,
80065
80119
  {
80066
80120
  walletAddress: address,
80121
+ ...jobIdExtras(msg.content),
80067
80122
  messageId: msg.id,
80068
- conversationId: conv.id
80123
+ conversationId: conv.id,
80124
+ stage: "offlineReplay/handleMessage",
80125
+ reason: err2 instanceof Error ? err2.name : "unknown_error"
80069
80126
  }
80070
80127
  );
80071
80128
  } finally {
@@ -80084,6 +80141,8 @@ var XmtpService = class _XmtpService {
80084
80141
  err2 instanceof Error ? err2 : void 0,
80085
80142
  {
80086
80143
  walletAddress: address,
80144
+ stage: "offlineReplay/readConversation",
80145
+ reason: err2 instanceof Error ? err2.name : "unknown_error",
80087
80146
  conversationId: conv.id
80088
80147
  }
80089
80148
  );
@@ -80152,18 +80211,6 @@ var A2A_MESSAGE_TYPE = "a2a-agent-chat";
80152
80211
  var DEFAULT_A2A_TIPS = {
80153
80212
  "task-skill": "Read the okx-agent-task skill if you don't know the context"
80154
80213
  };
80155
- var A2A_MSG_SCHEME = {
80156
- msgType: `Message type identifier, fixed to "${A2A_MESSAGE_TYPE}"`,
80157
- content: "Message body",
80158
- contentType: 'Content type, fixed to "text"',
80159
- fromXmtpAddress: "Sender's XMTP address",
80160
- toXmtpAddress: "Receiver's XMTP address",
80161
- groupId: "XMTP group chat ID",
80162
- jobId: "A2A job ID",
80163
- sender: "Sender's agent identity, includes agentId / name / profileDescription / profilePicture / role / securityRate",
80164
- receiverAgentId: "Receiver's onchainos agentId (null if unknown)",
80165
- payload: "Optional extra data attached by the sender for the receiver; absent when the sender did not provide any"
80166
- };
80167
80214
  function isNonEmptyPlainObject(v) {
80168
80215
  return !!v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length > 0;
80169
80216
  }
@@ -80176,13 +80223,12 @@ function buildA2AEnvelope(params) {
80176
80223
  toXmtpAddress: params.toXmtpAddress,
80177
80224
  groupId: params.groupId,
80178
80225
  jobId: params.jobId,
80179
- sender: params.senderAgent ? { agentId: params.senderAgent.agentId, name: params.senderAgent.name, profileDescription: params.senderAgent.profileDescription, profilePicture: params.senderAgent.profilePicture, role: params.senderAgent.role, securityRate: params.senderAgent.securityRate } : null,
80226
+ sender: params.senderAgent ? { agentId: params.senderAgent.agentId, name: params.senderAgent.name, role: params.senderAgent.role } : null,
80180
80227
  receiverAgentId: params.receiverAgentId ?? null
80181
80228
  };
80182
80229
  if (isNonEmptyPlainObject(params.payload)) {
80183
80230
  envelope.payload = params.payload;
80184
80231
  }
80185
- envelope.scheme = A2A_MSG_SCHEME;
80186
80232
  envelope.tips = isNonEmptyPlainObject(params.tips) ? params.tips : DEFAULT_A2A_TIPS;
80187
80233
  return JSON.stringify(envelope, null, 2);
80188
80234
  }
@@ -80598,7 +80644,7 @@ async function listAllAgentsWithMetadata(previousFingerprint) {
80598
80644
  }
80599
80645
  page++;
80600
80646
  }
80601
- const active = agents.filter((a) => a.status === 1 /* ACTIVE */);
80647
+ const active = agents.filter(isAgentXmtpCommunicable);
80602
80648
  const fingerprint = fingerprintAgents(active);
80603
80649
  const changed = previousFingerprint === void 0 || previousFingerprint !== fingerprint;
80604
80650
  const stderrLines = stderrs.map(filterNoisyAgentIdentityLog).filter((line) => line.length > 0);
@@ -80704,7 +80750,7 @@ async function checkMessageEligible(params) {
80704
80750
  ]));
80705
80751
  } catch (err2) {
80706
80752
  guardCatchSessionExpired(err2, "message-eligible");
80707
- return { eligible: false, reason: "message-eligible-cli-error" };
80753
+ throw new Error("message-eligible-cli-error", { cause: err2 });
80708
80754
  }
80709
80755
  if (stderr) {
80710
80756
  console.log(`[onchainos] stderr (message-eligible): ${stderr}`);
@@ -80722,13 +80768,13 @@ async function checkMessageEligible(params) {
80722
80768
  direction: params.direction,
80723
80769
  providerSecurityRate: String(params.providerSecurityRate)
80724
80770
  });
80725
- } catch {
80726
- return { eligible: false, reason: "message-eligible-json-parse-failed" };
80771
+ } catch (err2) {
80772
+ throw new Error("message-eligible-json-parse-failed", { cause: err2 });
80727
80773
  }
80728
80774
  if (!res.ok) {
80729
80775
  guardSessionExpired(stdout, "message-eligible");
80730
80776
  console.warn(
80731
- `[onchainos] message-eligible ok=false, blocking message: ${stdout.slice(0, 200)}`
80777
+ `[onchainos] message-eligible ok=false: ${stdout.slice(0, 200)}`
80732
80778
  );
80733
80779
  logger.error(
80734
80780
  LogEvent.ONCHAINOS_CLI_ERROR,
@@ -80747,7 +80793,7 @@ async function checkMessageEligible(params) {
80747
80793
  reason: "ok=false"
80748
80794
  })
80749
80795
  );
80750
- return { eligible: false, reason: "message-eligible-ok-false" };
80796
+ throw new Error("message-eligible-ok-false");
80751
80797
  }
80752
80798
  console.log(
80753
80799
  `[onchainos] message-eligible result: eligible=${res.data.eligible}`
@@ -81147,10 +81193,10 @@ async function assertOutboundEligible(params) {
81147
81193
  });
81148
81194
  } catch (err2) {
81149
81195
  console.log(
81150
- `[okx-agent-task] outbound message-eligible call failed, blocking send: senderAgentId=${senderAgent.agentId} receiverAgentId=${receiverAgent.agentId} job=${jobId} group=${groupId}`,
81196
+ `[okx-agent-task] outbound message-eligible call failed, letting send continue: senderAgentId=${senderAgent.agentId} receiverAgentId=${receiverAgent.agentId} job=${jobId} group=${groupId}`,
81151
81197
  err2
81152
81198
  );
81153
- throw new Error("unable to verify message eligibility for this task/group");
81199
+ return;
81154
81200
  }
81155
81201
  console.log(
81156
81202
  `[okx-agent-task] outbound message-eligible: senderAgentId=${senderAgent.agentId} receiverAgentId=${receiverAgent.agentId} job=${jobId} group=${groupId} result=${JSON.stringify(result)}`
@@ -82553,7 +82599,8 @@ async function isTrustedDmSender(params) {
82553
82599
  peerInboxId: senderInboxId,
82554
82600
  messageId,
82555
82601
  conversationId,
82556
- chatType: "dm"
82602
+ chatType: "dm",
82603
+ stage: "inbound/dm_trust_check"
82557
82604
  });
82558
82605
  const matches = (ids) => {
82559
82606
  if (ids.length === 0) {
@@ -82568,11 +82615,11 @@ async function isTrustedDmSender(params) {
82568
82615
  trustedInboxIds = svc.getTrustedDmInboxIds();
82569
82616
  }
82570
82617
  if (trustedInboxIds.length === 0) {
82571
- logger.info(LogEvent.DM_WHITELIST_FAIL_OPEN, dmExtras());
82618
+ logger.info(LogEvent.DM_WHITELIST_FAIL_OPEN, { ...dmExtras(), reason: "trusted_inbox_list_empty" });
82572
82619
  return true;
82573
82620
  }
82574
82621
  if (!matches(trustedInboxIds)) {
82575
- logger.info(LogEvent.INBOUND_DROP_DM_NON_SYSTEM, dmExtras());
82622
+ logger.info(LogEvent.INBOUND_DROP_DM_NON_SYSTEM, { ...dmExtras(), reason: "sender_not_in_system_whitelist" });
82576
82623
  console.log(
82577
82624
  `[okx-agent-task:${myXmtpAddress}] DM sender not in system whitelist, dropping: senderInboxId=${senderInboxId || "(empty)"}`
82578
82625
  );
@@ -82619,7 +82666,9 @@ async function claimedAddressMatchesSender(params) {
82619
82666
  peerInboxId: senderInboxId,
82620
82667
  taskId: "",
82621
82668
  conversationId,
82622
- messageId
82669
+ messageId,
82670
+ stage: "inbound/address_check",
82671
+ reason: err2 instanceof Error ? err2.name : "unknown_error"
82623
82672
  }
82624
82673
  );
82625
82674
  return false;
@@ -82668,6 +82717,7 @@ async function verifyInboundA2AGroupMessage(params) {
82668
82717
  conversationId: groupId,
82669
82718
  messageId,
82670
82719
  action: "auto-deny",
82720
+ stage: "inbound/address_check",
82671
82721
  reason: "claimed-address-mismatch"
82672
82722
  });
82673
82723
  }
@@ -82683,6 +82733,8 @@ async function verifyInboundA2AGroupMessage(params) {
82683
82733
  conversationId: groupId,
82684
82734
  messageId,
82685
82735
  consentState: String(consentState ?? ""),
82736
+ stage: "inbound/address_check",
82737
+ reason: "claimed_address_mismatch",
82686
82738
  action: autoDenyAttempted ? "auto-deny" : "drop",
82687
82739
  autoDenyAttempted: String(autoDenyAttempted),
82688
82740
  autoDenySucceeded: String(autoDenySucceeded),
@@ -82697,7 +82749,7 @@ async function verifyInboundA2AGroupMessage(params) {
82697
82749
  return true;
82698
82750
  }
82699
82751
  const isSenderClient = senderRole === 1 /* CLIENT */;
82700
- const providerSecurityRate = (isSenderClient ? myAgent.securityRate : readNumber(sender?.securityRate)) ?? 0;
82752
+ const providerSecurityRate = (isSenderClient ? myAgent.securityRate : service.getAgentStatusByAgentId(senderAgentId)?.securityRate) ?? 0;
82701
82753
  try {
82702
82754
  const result = await checkMessageEligible({
82703
82755
  agentId: myAgent.agentId,
@@ -82727,16 +82779,17 @@ async function verifyInboundA2AGroupMessage(params) {
82727
82779
  messageId,
82728
82780
  direction: isSenderClient ? "client_to_provider" : "provider_to_client",
82729
82781
  providerSecurityRate: String(providerSecurityRate),
82782
+ stage: "inbound/eligibility_check",
82730
82783
  reason: result.reason ?? ""
82731
82784
  });
82732
82785
  return false;
82733
82786
  }
82734
82787
  } catch (err2) {
82735
82788
  console.log(
82736
- `[okx-agent-task:${myXmtpAddress}] message-eligible call failed, dropping:`,
82789
+ `[okx-agent-task:${myXmtpAddress}] message-eligible call failed, letting message through:`,
82737
82790
  err2
82738
82791
  );
82739
- logger.info(LogEvent.INBOUND_BLOCKED_INELIGIBLE, {
82792
+ logger.error(LogEvent.INBOUND_ELIGIBILITY_BYPASSED, err2 instanceof Error ? err2 : new Error(String(err2)), {
82740
82793
  ...agentExtras({ walletAddress: myXmtpAddress, onchainosAgentId: myAgent.agentId }),
82741
82794
  peerWalletAddress: senderAddress,
82742
82795
  peerInboxId: senderInboxId,
@@ -82746,9 +82799,10 @@ async function verifyInboundA2AGroupMessage(params) {
82746
82799
  messageId,
82747
82800
  direction: isSenderClient ? "client_to_provider" : "provider_to_client",
82748
82801
  providerSecurityRate: String(providerSecurityRate),
82802
+ stage: "inbound/eligibility_check",
82749
82803
  reason: "exception"
82750
82804
  });
82751
- return false;
82805
+ return true;
82752
82806
  }
82753
82807
  return true;
82754
82808
  }
@@ -82782,7 +82836,9 @@ async function processFileMessage(ctx, deps, options = {}) {
82782
82836
  {
82783
82837
  ...agentExtras({ walletAddress: deps.myXmtpAddress }),
82784
82838
  taskId: systemNotification.jobId ?? "",
82785
- messageId: systemMessageId
82839
+ messageId: systemMessageId,
82840
+ stage: "inbound/payload_parse",
82841
+ reason: "system_dm_missing_agent_id"
82786
82842
  }
82787
82843
  );
82788
82844
  }
@@ -82845,7 +82901,9 @@ async function processFileMessage(ctx, deps, options = {}) {
82845
82901
  messageId,
82846
82902
  chatType: "group",
82847
82903
  msgType: readString2(payloadObject?.msgType) ?? "",
82848
- msgTypeType: typeof payloadObject?.msgType
82904
+ msgTypeType: typeof payloadObject?.msgType,
82905
+ stage: "inbound/payload_parse",
82906
+ reason: "unsupported_msg_type"
82849
82907
  });
82850
82908
  return true;
82851
82909
  }
@@ -83237,7 +83295,7 @@ function startUserAttentionWatcherCoordinator(options) {
83237
83295
  var environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
83238
83296
  var SENTRY_CONFIG = {
83239
83297
  projectName: "okx/openclaw-okx-a2a-extension",
83240
- release: "0.0.4",
83298
+ release: "0.0.6-beta-d32218fe3e-260611141219",
83241
83299
  environment
83242
83300
  };
83243
83301
 
@@ -83356,12 +83414,12 @@ async function runListenerWithLock(options, paths) {
83356
83414
  }));
83357
83415
  }
83358
83416
  });
83359
- service.setPluginVersion("0.0.4");
83417
+ service.setPluginVersion("0.0.6-beta-d32218fe3e-260611141219");
83360
83418
  await service.init();
83361
83419
  const pluginVersionStatus = service.pluginVersionStatus;
83362
83420
  if (pluginVersionStatus.unavailable) {
83363
83421
  throw new Error(
83364
- `@okxweb3/a2a-node v${"0.0.4"} is below the required minimum v${pluginVersionStatus.minVersion}`
83422
+ `@okxweb3/a2a-node v${"0.0.6-beta-d32218fe3e-260611141219"} is below the required minimum v${pluginVersionStatus.minVersion}`
83365
83423
  );
83366
83424
  }
83367
83425
  const systemConfig = service.getSystemConfig();
@@ -83379,7 +83437,7 @@ async function runListenerWithLock(options, paths) {
83379
83437
  onchainosAgentId: "*",
83380
83438
  reason: "system-config missing sentryDsn",
83381
83439
  pluginId: "@okxweb3/a2a-node",
83382
- pluginVersion: "0.0.4"
83440
+ pluginVersion: "0.0.6-beta-d32218fe3e-260611141219"
83383
83441
  });
83384
83442
  }
83385
83443
  console.log(
@@ -83412,6 +83470,7 @@ async function runListenerWithLock(options, paths) {
83412
83470
  logger.error(LogEvent.HEARTBEAT_FAILED, heartbeatResult.error instanceof Error ? heartbeatResult.error : new Error(String(heartbeatResult.error)), {
83413
83471
  component: "node_listener",
83414
83472
  stage: "sync_tick",
83473
+ reason: heartbeatResult.error instanceof Error ? heartbeatResult.error.name : "unknown_error",
83415
83474
  durationMs: String(heartbeatMs),
83416
83475
  chainIndex: ONCHAINOS_CHAIN_INDEX,
83417
83476
  communicationClass: "onchainos_or_network"
@@ -83422,6 +83481,7 @@ async function runListenerWithLock(options, paths) {
83422
83481
  logger.error(LogEvent.OFFLINE_REPLAY_FAILED, replayResult.error instanceof Error ? replayResult.error : new Error(String(replayResult.error)), {
83423
83482
  component: "node_listener",
83424
83483
  stage: "sync_tick",
83484
+ reason: replayResult.error instanceof Error ? replayResult.error.name : "unknown_error",
83425
83485
  durationMs: String(replayMs),
83426
83486
  communicationClass: "xmtp_replay_or_storage"
83427
83487
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okxweb3/a2a-node",
3
- "version": "0.0.4",
3
+ "version": "0.0.6-beta-d32218fe3e-260611141219",
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": {