@okxweb3/a2a-node 0.0.5 → 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 +42 -26
  2. package/dist/index.js +31 -24
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -18417,7 +18417,7 @@ var init_sentry_config = __esm({
18417
18417
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
18418
18418
  SENTRY_CONFIG = {
18419
18419
  projectName: "okx/openclaw-okx-a2a-extension",
18420
- release: "0.0.5",
18420
+ release: "0.0.6-beta-d32218fe3e-260611141219",
18421
18421
  environment
18422
18422
  };
18423
18423
  }
@@ -77210,6 +77210,35 @@ var init_installation_prune = __esm({
77210
77210
  }
77211
77211
  });
77212
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
+
77213
77242
  // ../core/src/xmtp-sdk/index.ts
77214
77243
  function cachePath(dataDir, fileName) {
77215
77244
  return (0, import_node_path11.join)(dataDir, fileName);
@@ -77551,7 +77580,7 @@ function parseGroupPayload(content3) {
77551
77580
  }
77552
77581
  }
77553
77582
  function isAgentUnavailable(agent) {
77554
- return !!agent && AGENT_UNAVAILABLE_STATUSES.has(Number(agent.status));
77583
+ return isAgentXmtpBlocked(agent);
77555
77584
  }
77556
77585
  function createOfflineReplayAddressSummary(address) {
77557
77586
  return {
@@ -77570,7 +77599,7 @@ function createOfflineReplayAddressSummary(address) {
77570
77599
  durationMs: 0
77571
77600
  };
77572
77601
  }
77573
- 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;
77574
77603
  var init_xmtp_sdk = __esm({
77575
77604
  "../core/src/xmtp-sdk/index.ts"() {
77576
77605
  "use strict";
@@ -77585,6 +77614,7 @@ var init_xmtp_sdk = __esm({
77585
77614
  init_concurrency();
77586
77615
  init_a2a_paths();
77587
77616
  init_installation_prune();
77617
+ init_agent_status();
77588
77618
  DEFAULT_DATA_DIR = resolveA2aTaskPaths().xmtpDir;
77589
77619
  SENSITIVE_WORDS_LAZY_RETRY_COOLDOWN_MS = 10 * 60 * 1e3;
77590
77620
  SESSION_EXPIRED_RE = /session expired/i;
@@ -77599,7 +77629,6 @@ var init_xmtp_sdk = __esm({
77599
77629
  }
77600
77630
  };
77601
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-]+)*)?$/;
77602
- AGENT_UNAVAILABLE_STATUSES = /* @__PURE__ */ new Set([2, 3, 4]);
77603
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.";
77604
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.";
77605
77634
  XmtpService = class _XmtpService {
@@ -78448,7 +78477,6 @@ var init_xmtp_sdk = __esm({
78448
78477
  toXmtpAddress: metaPayload.fromXmtpAddress ?? peerMsgs[0].senderInboxId,
78449
78478
  toAgentId: metaPayload.sender?.agentId ?? null,
78450
78479
  jobId: metaPayload.jobId,
78451
- securityRate: typeof metaPayload.sender?.securityRate === "number" ? metaPayload.sender.securityRate : 0,
78452
78480
  messages: chatMsgs
78453
78481
  });
78454
78482
  } catch (err2) {
@@ -78468,7 +78496,6 @@ var init_xmtp_sdk = __esm({
78468
78496
  );
78469
78497
  }
78470
78498
  }
78471
- result.sort((a, b) => b.securityRate - a.securityRate);
78472
78499
  return result;
78473
78500
  }
78474
78501
  async denyGroup(myXmtpAddress, groupId) {
@@ -79124,7 +79151,7 @@ async function listAllAgentsWithMetadata(previousFingerprint) {
79124
79151
  }
79125
79152
  page++;
79126
79153
  }
79127
- const active = agents.filter((a) => a.status === 1 /* ACTIVE */);
79154
+ const active = agents.filter(isAgentXmtpCommunicable);
79128
79155
  const fingerprint = fingerprintAgents(active);
79129
79156
  const changed = previousFingerprint === void 0 || previousFingerprint !== fingerprint;
79130
79157
  const stderrLines = stderrs.map(filterNoisyAgentIdentityLog).filter((line) => line.length > 0);
@@ -79360,6 +79387,8 @@ var init_onchainos = __esm({
79360
79387
  init_bin();
79361
79388
  init_sentry_logger();
79362
79389
  init_xmtp_sdk();
79390
+ init_agent_status();
79391
+ init_agent_status();
79363
79392
  CliErrorReason = {
79364
79393
  OK_FALSE: "ok_false",
79365
79394
  JSON_PARSE_FAILED: "json_parse_failed"
@@ -79478,17 +79507,16 @@ function buildA2AEnvelope(params) {
79478
79507
  toXmtpAddress: params.toXmtpAddress,
79479
79508
  groupId: params.groupId,
79480
79509
  jobId: params.jobId,
79481
- 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,
79482
79511
  receiverAgentId: params.receiverAgentId ?? null
79483
79512
  };
79484
79513
  if (isNonEmptyPlainObject(params.payload)) {
79485
79514
  envelope.payload = params.payload;
79486
79515
  }
79487
- envelope.scheme = A2A_MSG_SCHEME;
79488
79516
  envelope.tips = isNonEmptyPlainObject(params.tips) ? params.tips : DEFAULT_A2A_TIPS;
79489
79517
  return JSON.stringify(envelope, null, 2);
79490
79518
  }
79491
- var DEFAULT_A2A_TIPS, A2A_MSG_SCHEME;
79519
+ var DEFAULT_A2A_TIPS;
79492
79520
  var init_envelope_shared = __esm({
79493
79521
  "../core/src/a2a/envelope.shared.ts"() {
79494
79522
  "use strict";
@@ -79496,18 +79524,6 @@ var init_envelope_shared = __esm({
79496
79524
  DEFAULT_A2A_TIPS = {
79497
79525
  "task-skill": "Read the okx-agent-task skill if you don't know the context"
79498
79526
  };
79499
- A2A_MSG_SCHEME = {
79500
- msgType: `Message type identifier, fixed to "${A2A_MESSAGE_TYPE}"`,
79501
- content: "Message body",
79502
- contentType: 'Content type, fixed to "text"',
79503
- fromXmtpAddress: "Sender's XMTP address",
79504
- toXmtpAddress: "Receiver's XMTP address",
79505
- groupId: "XMTP group chat ID",
79506
- jobId: "A2A job ID",
79507
- sender: "Sender's agent identity, includes agentId / name / profileDescription / profilePicture / role / securityRate",
79508
- receiverAgentId: "Receiver's onchainos agentId (null if unknown)",
79509
- payload: "Optional extra data attached by the sender for the receiver; absent when the sender did not provide any"
79510
- };
79511
79527
  }
79512
79528
  });
79513
79529
 
@@ -84106,7 +84122,7 @@ async function verifyInboundA2AGroupMessage(params) {
84106
84122
  return true;
84107
84123
  }
84108
84124
  const isSenderClient = senderRole === 1 /* CLIENT */;
84109
- const providerSecurityRate = (isSenderClient ? myAgent.securityRate : readNumber(sender?.securityRate)) ?? 0;
84125
+ const providerSecurityRate = (isSenderClient ? myAgent.securityRate : service.getAgentStatusByAgentId(senderAgentId)?.securityRate) ?? 0;
84110
84126
  try {
84111
84127
  const result = await checkMessageEligible({
84112
84128
  agentId: myAgent.agentId,
@@ -84692,12 +84708,12 @@ async function runListenerWithLock(options, paths) {
84692
84708
  }));
84693
84709
  }
84694
84710
  });
84695
- service.setPluginVersion("0.0.5");
84711
+ service.setPluginVersion("0.0.6-beta-d32218fe3e-260611141219");
84696
84712
  await service.init();
84697
84713
  const pluginVersionStatus = service.pluginVersionStatus;
84698
84714
  if (pluginVersionStatus.unavailable) {
84699
84715
  throw new Error(
84700
- `@okxweb3/a2a-node v${"0.0.5"} 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}`
84701
84717
  );
84702
84718
  }
84703
84719
  const systemConfig = service.getSystemConfig();
@@ -84715,7 +84731,7 @@ async function runListenerWithLock(options, paths) {
84715
84731
  onchainosAgentId: "*",
84716
84732
  reason: "system-config missing sentryDsn",
84717
84733
  pluginId: "@okxweb3/a2a-node",
84718
- pluginVersion: "0.0.5"
84734
+ pluginVersion: "0.0.6-beta-d32218fe3e-260611141219"
84719
84735
  });
84720
84736
  }
84721
84737
  console.log(
package/dist/index.js CHANGED
@@ -78552,6 +78552,29 @@ function compareTimestamp(a, b) {
78552
78552
  return 0;
78553
78553
  }
78554
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
+
78555
78578
  // ../core/src/xmtp-sdk/index.ts
78556
78579
  var DEFAULT_DATA_DIR = resolveA2aTaskPaths().xmtpDir;
78557
78580
  function cachePath(dataDir, fileName) {
@@ -78900,11 +78923,10 @@ function parseGroupPayload(content3) {
78900
78923
  return null;
78901
78924
  }
78902
78925
  }
78903
- var AGENT_UNAVAILABLE_STATUSES = /* @__PURE__ */ new Set([2, 3, 4]);
78904
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.";
78905
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.";
78906
78928
  function isAgentUnavailable(agent) {
78907
- return !!agent && AGENT_UNAVAILABLE_STATUSES.has(Number(agent.status));
78929
+ return isAgentXmtpBlocked(agent);
78908
78930
  }
78909
78931
  var XmtpService = class _XmtpService {
78910
78932
  static instance = null;
@@ -79752,7 +79774,6 @@ var XmtpService = class _XmtpService {
79752
79774
  toXmtpAddress: metaPayload.fromXmtpAddress ?? peerMsgs[0].senderInboxId,
79753
79775
  toAgentId: metaPayload.sender?.agentId ?? null,
79754
79776
  jobId: metaPayload.jobId,
79755
- securityRate: typeof metaPayload.sender?.securityRate === "number" ? metaPayload.sender.securityRate : 0,
79756
79777
  messages: chatMsgs
79757
79778
  });
79758
79779
  } catch (err2) {
@@ -79772,7 +79793,6 @@ var XmtpService = class _XmtpService {
79772
79793
  );
79773
79794
  }
79774
79795
  }
79775
- result.sort((a, b) => b.securityRate - a.securityRate);
79776
79796
  return result;
79777
79797
  }
79778
79798
  async denyGroup(myXmtpAddress, groupId) {
@@ -80191,18 +80211,6 @@ var A2A_MESSAGE_TYPE = "a2a-agent-chat";
80191
80211
  var DEFAULT_A2A_TIPS = {
80192
80212
  "task-skill": "Read the okx-agent-task skill if you don't know the context"
80193
80213
  };
80194
- var A2A_MSG_SCHEME = {
80195
- msgType: `Message type identifier, fixed to "${A2A_MESSAGE_TYPE}"`,
80196
- content: "Message body",
80197
- contentType: 'Content type, fixed to "text"',
80198
- fromXmtpAddress: "Sender's XMTP address",
80199
- toXmtpAddress: "Receiver's XMTP address",
80200
- groupId: "XMTP group chat ID",
80201
- jobId: "A2A job ID",
80202
- sender: "Sender's agent identity, includes agentId / name / profileDescription / profilePicture / role / securityRate",
80203
- receiverAgentId: "Receiver's onchainos agentId (null if unknown)",
80204
- payload: "Optional extra data attached by the sender for the receiver; absent when the sender did not provide any"
80205
- };
80206
80214
  function isNonEmptyPlainObject(v) {
80207
80215
  return !!v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length > 0;
80208
80216
  }
@@ -80215,13 +80223,12 @@ function buildA2AEnvelope(params) {
80215
80223
  toXmtpAddress: params.toXmtpAddress,
80216
80224
  groupId: params.groupId,
80217
80225
  jobId: params.jobId,
80218
- 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,
80219
80227
  receiverAgentId: params.receiverAgentId ?? null
80220
80228
  };
80221
80229
  if (isNonEmptyPlainObject(params.payload)) {
80222
80230
  envelope.payload = params.payload;
80223
80231
  }
80224
- envelope.scheme = A2A_MSG_SCHEME;
80225
80232
  envelope.tips = isNonEmptyPlainObject(params.tips) ? params.tips : DEFAULT_A2A_TIPS;
80226
80233
  return JSON.stringify(envelope, null, 2);
80227
80234
  }
@@ -80637,7 +80644,7 @@ async function listAllAgentsWithMetadata(previousFingerprint) {
80637
80644
  }
80638
80645
  page++;
80639
80646
  }
80640
- const active = agents.filter((a) => a.status === 1 /* ACTIVE */);
80647
+ const active = agents.filter(isAgentXmtpCommunicable);
80641
80648
  const fingerprint = fingerprintAgents(active);
80642
80649
  const changed = previousFingerprint === void 0 || previousFingerprint !== fingerprint;
80643
80650
  const stderrLines = stderrs.map(filterNoisyAgentIdentityLog).filter((line) => line.length > 0);
@@ -82742,7 +82749,7 @@ async function verifyInboundA2AGroupMessage(params) {
82742
82749
  return true;
82743
82750
  }
82744
82751
  const isSenderClient = senderRole === 1 /* CLIENT */;
82745
- const providerSecurityRate = (isSenderClient ? myAgent.securityRate : readNumber(sender?.securityRate)) ?? 0;
82752
+ const providerSecurityRate = (isSenderClient ? myAgent.securityRate : service.getAgentStatusByAgentId(senderAgentId)?.securityRate) ?? 0;
82746
82753
  try {
82747
82754
  const result = await checkMessageEligible({
82748
82755
  agentId: myAgent.agentId,
@@ -83288,7 +83295,7 @@ function startUserAttentionWatcherCoordinator(options) {
83288
83295
  var environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
83289
83296
  var SENTRY_CONFIG = {
83290
83297
  projectName: "okx/openclaw-okx-a2a-extension",
83291
- release: "0.0.5",
83298
+ release: "0.0.6-beta-d32218fe3e-260611141219",
83292
83299
  environment
83293
83300
  };
83294
83301
 
@@ -83407,12 +83414,12 @@ async function runListenerWithLock(options, paths) {
83407
83414
  }));
83408
83415
  }
83409
83416
  });
83410
- service.setPluginVersion("0.0.5");
83417
+ service.setPluginVersion("0.0.6-beta-d32218fe3e-260611141219");
83411
83418
  await service.init();
83412
83419
  const pluginVersionStatus = service.pluginVersionStatus;
83413
83420
  if (pluginVersionStatus.unavailable) {
83414
83421
  throw new Error(
83415
- `@okxweb3/a2a-node v${"0.0.5"} 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}`
83416
83423
  );
83417
83424
  }
83418
83425
  const systemConfig = service.getSystemConfig();
@@ -83430,7 +83437,7 @@ async function runListenerWithLock(options, paths) {
83430
83437
  onchainosAgentId: "*",
83431
83438
  reason: "system-config missing sentryDsn",
83432
83439
  pluginId: "@okxweb3/a2a-node",
83433
- pluginVersion: "0.0.5"
83440
+ pluginVersion: "0.0.6-beta-d32218fe3e-260611141219"
83434
83441
  });
83435
83442
  }
83436
83443
  console.log(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okxweb3/a2a-node",
3
- "version": "0.0.5",
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": {