@okxweb3/a2a-node 0.2.6-beta-5b74111b38-260814145826 → 0.2.6

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 +99 -36
  2. package/dist/index.js +97 -33
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -26648,7 +26648,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
26648
26648
  client: {
26649
26649
  id: "gateway-client",
26650
26650
  displayName: "okx-a2a-node",
26651
- version: "0.2.6-beta-5b74111b38-260814145826",
26651
+ version: "0.2.6",
26652
26652
  platform: "node",
26653
26653
  mode: "backend",
26654
26654
  instanceId
@@ -26659,7 +26659,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
26659
26659
  commands: [],
26660
26660
  permissions: {},
26661
26661
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
26662
- userAgent: `okx-a2a-node/${"0.2.6-beta-5b74111b38-260814145826"}`,
26662
+ userAgent: `okx-a2a-node/${"0.2.6"}`,
26663
26663
  auth: {
26664
26664
  ...config.token ? { token: config.token } : {},
26665
26665
  ...config.password ? { password: config.password } : {}
@@ -28568,7 +28568,7 @@ var init_sentry_config = __esm({
28568
28568
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
28569
28569
  SENTRY_CONFIG = {
28570
28570
  projectName: "okx/openclaw-okx-a2a-extension",
28571
- release: "0.2.6-beta-5b74111b38-260814145826",
28571
+ release: "0.2.6",
28572
28572
  environment,
28573
28573
  runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
28574
28574
  };
@@ -39738,7 +39738,7 @@ async function exportDiagnosticLogs(options) {
39738
39738
  node: process.version,
39739
39739
  platform: process.platform,
39740
39740
  arch: process.arch,
39741
- packageVersion: true ? "0.2.6-beta-5b74111b38-260814145826" : "unknown",
39741
+ packageVersion: true ? "0.2.6" : "unknown",
39742
39742
  sensitiveContentIncluded: options.includeSensitiveContent,
39743
39743
  listenerAndLlmContentIncluded: true,
39744
39744
  credentialsAlwaysRedacted: true,
@@ -59820,6 +59820,30 @@ var init_a2a = __esm({
59820
59820
  function isNonEmptyPlainObject(v) {
59821
59821
  return !!v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length > 0;
59822
59822
  }
59823
+ function readStringRecord(value) {
59824
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
59825
+ return {};
59826
+ }
59827
+ return Object.fromEntries(
59828
+ Object.entries(value).filter((entry) => typeof entry[1] === "string")
59829
+ );
59830
+ }
59831
+ function mergeA2AEnvelopeTips(payload, receiverTips) {
59832
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
59833
+ return payload;
59834
+ }
59835
+ const envelope = payload;
59836
+ if (envelope.msgType !== A2A_MESSAGE_TYPE) {
59837
+ return payload;
59838
+ }
59839
+ return {
59840
+ ...envelope,
59841
+ tips: {
59842
+ ...readStringRecord(envelope.tips),
59843
+ ...readStringRecord(receiverTips)
59844
+ }
59845
+ };
59846
+ }
59823
59847
  function buildA2AEnvelope(params) {
59824
59848
  const envelope = {
59825
59849
  msgType: A2A_MESSAGE_TYPE,
@@ -65623,11 +65647,11 @@ function extractXmtpSentAtMs2(msg) {
65623
65647
  }
65624
65648
  return Date.now();
65625
65649
  }
65626
- function parsePayload(rawText) {
65650
+ function parseJson2(rawText) {
65627
65651
  try {
65628
- return { parsed: true, payload: JSON.parse(rawText) };
65652
+ return { ok: true, data: JSON.parse(rawText) };
65629
65653
  } catch {
65630
- return { parsed: false, payload: null };
65654
+ return { ok: false, data: null };
65631
65655
  }
65632
65656
  }
65633
65657
  function readString5(value) {
@@ -66536,10 +66560,21 @@ async function processFileMessage(ctx, deps, options = {}) {
66536
66560
  }
66537
66561
  }
66538
66562
  const parseStartedAt = Date.now();
66539
- const rawText = extractRawText(ctx.message.content);
66540
- const parsed = parsePayload(rawText);
66563
+ const receivedRawText = extractRawText(ctx.message.content);
66564
+ const parseResult = parseJson2(receivedRawText);
66565
+ let rawText = receivedRawText;
66566
+ if (parseResult.ok) {
66567
+ const mergedPayload = mergeA2AEnvelopeTips(
66568
+ parseResult.data,
66569
+ XmtpService.getInstance().getSystemConfig().extConfig.tips
66570
+ );
66571
+ if (mergedPayload !== parseResult.data) {
66572
+ parseResult.data = mergedPayload;
66573
+ rawText = stringifySystemPayload(mergedPayload);
66574
+ }
66575
+ }
66541
66576
  timing.mark("payloadParse", parseStartedAt);
66542
- const directToUser = chatType === "dm" && parsed.parsed ? extractDirectToUserNotification(parsed.payload) : { kind: "none" };
66577
+ const directToUser = chatType === "dm" && parseResult.ok ? extractDirectToUserNotification(parseResult.data) : { kind: "none" };
66543
66578
  if (directToUser.kind === "invalid") {
66544
66579
  const droppedMessageId = messageId || `direct-to-user-${(0, import_node_crypto14.randomUUID)()}`;
66545
66580
  logger.error(
@@ -66571,7 +66606,7 @@ async function processFileMessage(ctx, deps, options = {}) {
66571
66606
  });
66572
66607
  return true;
66573
66608
  }
66574
- const systemNotification = chatType === "dm" && parsed.parsed ? extractSystemNotification(parsed.payload) : null;
66609
+ const systemNotification = chatType === "dm" && parseResult.ok ? extractSystemNotification(parseResult.data) : null;
66575
66610
  if (systemNotification) {
66576
66611
  const systemMessageId = messageId || `system-${(0, import_node_crypto14.randomUUID)()}`;
66577
66612
  logWithTimestamp(
@@ -66679,7 +66714,7 @@ async function processFileMessage(ctx, deps, options = {}) {
66679
66714
  maybeNotifyInboundAgentMessage({
66680
66715
  deps,
66681
66716
  chatType,
66682
- payload: parsed.payload,
66717
+ payload: parseResult.data,
66683
66718
  jobId: systemNotification.jobId ?? BACKUP_JOB_ID,
66684
66719
  sessionKey: primaryTarget?.sessionKey ?? SYSTEM_NOTIFICATION_SESSION_KEY,
66685
66720
  messageId: systemMessageId
@@ -66724,13 +66759,13 @@ async function processFileMessage(ctx, deps, options = {}) {
66724
66759
  }));
66725
66760
  });
66726
66761
  logWithTimestamp(
66727
- `[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=system/${target.route} session=${target.sessionKey} message=${shortenLogValue(systemMessageId)} ${summarizePayloadForLog(parsed.payload)}`
66762
+ `[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=system/${target.route} session=${target.sessionKey} message=${shortenLogValue(systemMessageId)} ${summarizePayloadForLog(parseResult.data)}`
66728
66763
  );
66729
66764
  }
66730
66765
  return true;
66731
66766
  }
66732
66767
  const routeStartedAt = Date.now();
66733
- const route = routeMessage(chatType, parsed.parsed, parsed.payload);
66768
+ const route = routeMessage(chatType, parseResult.ok, parseResult.data);
66734
66769
  timing.mark("routeResolve", routeStartedAt);
66735
66770
  if (route.route === "job") {
66736
66771
  const providerBindStartedAt = Date.now();
@@ -66756,7 +66791,7 @@ async function processFileMessage(ctx, deps, options = {}) {
66756
66791
  }
66757
66792
  const sessionAgentId = route.route === "job" ? resolveSessionAgentId({
66758
66793
  chatType,
66759
- payload: parsed.parsed ? parsed.payload : null,
66794
+ payload: parseResult.ok ? parseResult.data : null,
66760
66795
  myXmtpAddress: deps.myXmtpAddress
66761
66796
  }) : null;
66762
66797
  const xmtpSentAtMs = extractXmtpSentAtMs2(ctx.message);
@@ -66772,7 +66807,7 @@ async function processFileMessage(ctx, deps, options = {}) {
66772
66807
  );
66773
66808
  }
66774
66809
  if (route.route === "job" && chatType === "group") {
66775
- const payloadObject = isPlainObject3(parsed.parsed ? parsed.payload : null) ? parsed.payload : null;
66810
+ const payloadObject = isPlainObject3(parseResult.ok ? parseResult.data : null) ? parseResult.data : null;
66776
66811
  const service = XmtpService.getInstance();
66777
66812
  const trustedSystemSender = service.isTrustedSystemAccountSender({
66778
66813
  senderAddress,
@@ -66803,7 +66838,7 @@ async function processFileMessage(ctx, deps, options = {}) {
66803
66838
  const myAgentId = localAgent?.agentId ?? readString5(payloadObject?.receiverAgentId) ?? sessionAgentId ?? null;
66804
66839
  const toAgentId = readString5(sender?.agentId);
66805
66840
  const accepted = await verifyInboundA2AGroupMessage({
66806
- payload: parsed.parsed ? parsed.payload : null,
66841
+ payload: parseResult.ok ? parseResult.data : null,
66807
66842
  myXmtpAddress: deps.myXmtpAddress,
66808
66843
  senderAddress,
66809
66844
  senderInboxId: ctx.message.senderInboxId ?? "",
@@ -66870,7 +66905,7 @@ async function processFileMessage(ctx, deps, options = {}) {
66870
66905
  maybeNotifyInboundAgentMessage({
66871
66906
  deps,
66872
66907
  chatType,
66873
- payload: parsed.payload,
66908
+ payload: parseResult.data,
66874
66909
  jobId: route.jobId,
66875
66910
  sessionKey,
66876
66911
  messageId: routedMessageId,
@@ -66879,7 +66914,7 @@ async function processFileMessage(ctx, deps, options = {}) {
66879
66914
  }
66880
66915
  void maybeAllowProviderGroup(deps, chatType, conversationId);
66881
66916
  logWithTimestamp(
66882
- `[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=group session=${sessionKey} message=${shortenLogValue(routedMessageId)} ${summarizePayloadForLog(parsed.payload)}`
66917
+ `[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=group session=${sessionKey} message=${shortenLogValue(routedMessageId)} ${summarizePayloadForLog(parseResult.data)}`
66883
66918
  );
66884
66919
  return true;
66885
66920
  }
@@ -66896,12 +66931,12 @@ async function processFileMessage(ctx, deps, options = {}) {
66896
66931
  senderInboxId: ctx.message.senderInboxId ?? "",
66897
66932
  conversationId,
66898
66933
  rawText,
66899
- payload: parsed.parsed ? parsed.payload : null
66934
+ payload: parseResult.ok ? parseResult.data : null
66900
66935
  };
66901
66936
  const storeAppendStartedAt = Date.now();
66902
66937
  await deps.store.append(route.jobId, stored, sessionAgentId);
66903
66938
  timing.mark("storeAppend", storeAppendStartedAt);
66904
- if ((route.route === "job" || parsed.parsed && !isA2AEnvelope(stored.payload)) && !options.skipNotify) {
66939
+ if ((route.route === "job" || parseResult.ok && !isA2AEnvelope(stored.payload)) && !options.skipNotify) {
66905
66940
  const payloadObject = isPlainObject3(stored.payload) ? stored.payload : null;
66906
66941
  const sender = isPlainObject3(payloadObject?.sender) ? payloadObject.sender : null;
66907
66942
  const localAgent = XmtpService.getInstance().getAgentByAddress(deps.myXmtpAddress);
@@ -67091,6 +67126,7 @@ var init_message_handler = __esm({
67091
67126
  import_node_crypto14 = require("node:crypto");
67092
67127
  init_dist2();
67093
67128
  init_a2a();
67129
+ init_envelope_shared();
67094
67130
  init_xmtp_sdk();
67095
67131
  init_onchainos();
67096
67132
  init_sentry_logger();
@@ -67544,12 +67580,12 @@ async function runListenerWithLock(options, paths) {
67544
67580
  });
67545
67581
  }
67546
67582
  });
67547
- service.setPluginVersion("0.2.6-beta-5b74111b38-260814145826");
67583
+ service.setPluginVersion("0.2.6");
67548
67584
  await service.init();
67549
67585
  const pluginVersionStatus = service.pluginVersionStatus;
67550
67586
  if (pluginVersionStatus.unavailable) {
67551
67587
  throw new Error(
67552
- `@okxweb3/a2a-node v${"0.2.6-beta-5b74111b38-260814145826"} is below the required minimum v${pluginVersionStatus.minVersion}`
67588
+ `@okxweb3/a2a-node v${"0.2.6"} is below the required minimum v${pluginVersionStatus.minVersion}`
67553
67589
  );
67554
67590
  }
67555
67591
  const systemConfig = service.getSystemConfig();
@@ -67567,7 +67603,7 @@ async function runListenerWithLock(options, paths) {
67567
67603
  onchainosAgentId: "*",
67568
67604
  reason: "system-config missing sentryDsn",
67569
67605
  pluginId: "@okxweb3/a2a-node",
67570
- pluginVersion: "0.2.6-beta-5b74111b38-260814145826"
67606
+ pluginVersion: "0.2.6"
67571
67607
  });
67572
67608
  }
67573
67609
  logWithTimestamp(
@@ -115969,7 +116005,7 @@ async function getCurrentNodeCliVersion() {
115969
116005
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
115970
116006
  }
115971
116007
  function getBundledNodeCliVersion() {
115972
- return true ? "0.2.6-beta-5b74111b38-260814145826" : null;
116008
+ return true ? "0.2.6" : null;
115973
116009
  }
115974
116010
  function readConfiguredAiProvider() {
115975
116011
  const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
@@ -116179,7 +116215,7 @@ async function updateHermes(release, options) {
116179
116215
  }
116180
116216
  }
116181
116217
  async function installGatewayPluginForDoctor(target) {
116182
- const release = isPrereleaseVersion("0.2.6-beta-5b74111b38-260814145826") ? "beta" : "latest";
116218
+ const release = isPrereleaseVersion("0.2.6") ? "beta" : "latest";
116183
116219
  const insideTargetGateway = detectGatewayInvocation() === target;
116184
116220
  const options = {
116185
116221
  restart: !insideTargetGateway,
@@ -117194,7 +117230,10 @@ function resolveDoctorTarget(env = process.env) {
117194
117230
  function skipped(id, title, severity, reason) {
117195
117231
  return { id, title, status: "skipped", severity, detail: reason };
117196
117232
  }
117197
- function resolveProviderCliTarget(env, store) {
117233
+ function resolveProviderCliTarget(env, target, store) {
117234
+ if (target === "hermes") {
117235
+ return "hermes";
117236
+ }
117198
117237
  const runtime = detectRuntime(env);
117199
117238
  if (runtime === "codex" || runtime === "claude") {
117200
117239
  return runtime;
@@ -117205,10 +117244,10 @@ function resolveProviderCliTarget(env, store) {
117205
117244
  const storedDefault = store.getDefaultAiProvider();
117206
117245
  return storedDefault === "codex" || storedDefault === "claude" ? storedDefault : null;
117207
117246
  }
117208
- function readProviderCliTarget(env) {
117247
+ function readProviderCliTarget(env, target) {
117209
117248
  const store = new SessionStore();
117210
117249
  try {
117211
- const provider = resolveProviderCliTarget(env, store);
117250
+ const provider = resolveProviderCliTarget(env, target, store);
117212
117251
  return {
117213
117252
  provider,
117214
117253
  storedCommand: provider ? store.getAiProviderCommand(provider) : null
@@ -117222,7 +117261,7 @@ async function runDoctor(options = {}) {
117222
117261
  platform: options.platform ?? process.platform,
117223
117262
  env: options.env ?? process.env,
117224
117263
  target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
117225
- cliVersion: options.cliVersion ?? (true ? "0.2.6-beta-5b74111b38-260814145826" : "0.0.0"),
117264
+ cliVersion: options.cliVersion ?? (true ? "0.2.6" : "0.0.0"),
117226
117265
  fixMode: options.fix === true,
117227
117266
  nonInteractive: options.nonInteractive === true,
117228
117267
  packageChanged: false,
@@ -117687,12 +117726,26 @@ var init_doctor_cli = __esm({
117687
117726
  id: "provider_cli",
117688
117727
  title: "AI provider CLI",
117689
117728
  run: async (ctx) => {
117690
- const { provider, storedCommand } = readProviderCliTarget(ctx.env);
117729
+ const { provider, storedCommand } = readProviderCliTarget(ctx.env, ctx.target);
117691
117730
  if (!provider) {
117692
117731
  return null;
117693
117732
  }
117694
117733
  const resolved = provider === "codex" ? resolveCodexCommandPath(ctx.env, storedCommand, ctx.platform) : resolveCommandPath(resolveAiProviderCommand(provider, ctx.env, storedCommand, ctx.platform), ctx.env, ctx.platform);
117695
117734
  if (!resolved) {
117735
+ if (provider === "hermes") {
117736
+ return {
117737
+ id: "provider_cli",
117738
+ title: "AI provider CLI",
117739
+ status: "fail",
117740
+ severity: "required",
117741
+ detail: "hermes CLI is not installed or not usable on this machine",
117742
+ fix: {
117743
+ kind: "manual",
117744
+ description: "Install or repair the Hermes CLI, ensure the `hermes` executable is on PATH, then re-run okx-a2a doctor."
117745
+ },
117746
+ data: { provider }
117747
+ };
117748
+ }
117696
117749
  const spec = provider === "codex" ? CODEX_INSTALL_SPEC : CLAUDE_INSTALL_SPEC;
117697
117750
  return {
117698
117751
  id: "provider_cli",
@@ -117708,6 +117761,16 @@ var init_doctor_cli = __esm({
117708
117761
  data: { provider }
117709
117762
  };
117710
117763
  }
117764
+ if (provider === "hermes") {
117765
+ return {
117766
+ id: "provider_cli",
117767
+ title: "AI provider CLI",
117768
+ status: "pass",
117769
+ severity: "required",
117770
+ detail: "hermes CLI is installed and usable",
117771
+ data: { provider, command: resolved }
117772
+ };
117773
+ }
117711
117774
  const auth = provider === "codex" ? await checkCodexCliAuthStatus(resolved) : await checkClaudeCliAuthStatus(resolved);
117712
117775
  if (auth.ok) {
117713
117776
  if (provider === "codex" && ctx.env.OKX_A2A_AI_CODEX_COMMAND && storedCommand !== resolved) {
@@ -117761,8 +117824,8 @@ var init_doctor_cli = __esm({
117761
117824
  };
117762
117825
  },
117763
117826
  applyFix: async (ctx) => {
117764
- const { provider, storedCommand } = readProviderCliTarget(ctx.env);
117765
- if (!provider) {
117827
+ const { provider, storedCommand } = readProviderCliTarget(ctx.env, ctx.target);
117828
+ if (!provider || provider === "hermes") {
117766
117829
  throw new Error("no codex/claude runtime detected and no codex/claude provider bound");
117767
117830
  }
117768
117831
  const resolveCli = () => provider === "codex" ? resolveCodexCommandPath(ctx.env, storedCommand, ctx.platform) : resolveCommandPath(resolveAiProviderCommand(provider, ctx.env, storedCommand, ctx.platform), ctx.env, ctx.platform);
@@ -118220,7 +118283,7 @@ init_sentry_logger();
118220
118283
  init_sentry_config();
118221
118284
  var CURRENT_GATEWAY_SESSION_KEYS_ENV4 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
118222
118285
  function printUsage3() {
118223
- console.log(`okx-a2a ${"0.2.6-beta-5b74111b38-260814145826"}
118286
+ console.log(`okx-a2a ${"0.2.6"}
118224
118287
 
118225
118288
  Usage:
118226
118289
  okx-a2a <command> [options]
@@ -118260,7 +118323,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
118260
118323
  `);
118261
118324
  }
118262
118325
  function printVersion() {
118263
- console.log("0.2.6-beta-5b74111b38-260814145826");
118326
+ console.log("0.2.6");
118264
118327
  }
118265
118328
  function printDaemonUsage() {
118266
118329
  console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
@@ -119699,7 +119762,7 @@ async function main() {
119699
119762
  if (command === "xmtp-test") {
119700
119763
  const { handleXmtpTestCommand: handleXmtpTestCommand2 } = await Promise.resolve().then(() => (init_xmtp_test_cli(), xmtp_test_cli_exports));
119701
119764
  await handleXmtpTestCommand2(process.argv.slice(3), {
119702
- packageVersion: "0.2.6-beta-5b74111b38-260814145826",
119765
+ packageVersion: "0.2.6",
119703
119766
  agentSdkVersion: "2.3.0",
119704
119767
  nodeSdkVersion: "6.1.0",
119705
119768
  nodeBindingsVersion: "1.11.0"
package/dist/index.js CHANGED
@@ -32148,7 +32148,7 @@ var init_sentry_config = __esm({
32148
32148
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
32149
32149
  SENTRY_CONFIG = {
32150
32150
  projectName: "okx/openclaw-okx-a2a-extension",
32151
- release: "0.2.6-beta-5b74111b38-260814145826",
32151
+ release: "0.2.6",
32152
32152
  environment,
32153
32153
  runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
32154
32154
  };
@@ -33089,7 +33089,7 @@ async function getCurrentNodeCliVersion() {
33089
33089
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
33090
33090
  }
33091
33091
  function getBundledNodeCliVersion() {
33092
- return true ? "0.2.6-beta-5b74111b38-260814145826" : null;
33092
+ return true ? "0.2.6" : null;
33093
33093
  }
33094
33094
  function readConfiguredAiProvider() {
33095
33095
  const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
@@ -33299,7 +33299,7 @@ async function updateHermes(release, options) {
33299
33299
  }
33300
33300
  }
33301
33301
  async function installGatewayPluginForDoctor(target) {
33302
- const release = isPrereleaseVersion("0.2.6-beta-5b74111b38-260814145826") ? "beta" : "latest";
33302
+ const release = isPrereleaseVersion("0.2.6") ? "beta" : "latest";
33303
33303
  const insideTargetGateway = detectGatewayInvocation() === target;
33304
33304
  const options = {
33305
33305
  restart: !insideTargetGateway,
@@ -44152,6 +44152,7 @@ __export(index_exports, {
44152
44152
  logWinCompat: () => logWinCompat,
44153
44153
  logXmtpMessageSent: () => logXmtpMessageSent,
44154
44154
  maybeRecommendOnchainosUpgrade: () => maybeRecommendOnchainosUpgrade,
44155
+ mergeA2AEnvelopeTips: () => mergeA2AEnvelopeTips,
44155
44156
  messageEligibleHelpAdvertisesOfflineReplay: () => messageEligibleHelpAdvertisesOfflineReplay,
44156
44157
  nodeVersionSatisfies: () => nodeVersionSatisfies,
44157
44158
  normalizeAiProvider: () => normalizeAiProvider,
@@ -58595,6 +58596,30 @@ var DEFAULT_A2A_TIPS = {
58595
58596
  function isNonEmptyPlainObject(v) {
58596
58597
  return !!v && typeof v === "object" && !Array.isArray(v) && Object.keys(v).length > 0;
58597
58598
  }
58599
+ function readStringRecord(value) {
58600
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
58601
+ return {};
58602
+ }
58603
+ return Object.fromEntries(
58604
+ Object.entries(value).filter((entry) => typeof entry[1] === "string")
58605
+ );
58606
+ }
58607
+ function mergeA2AEnvelopeTips(payload, receiverTips) {
58608
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
58609
+ return payload;
58610
+ }
58611
+ const envelope = payload;
58612
+ if (envelope.msgType !== A2A_MESSAGE_TYPE) {
58613
+ return payload;
58614
+ }
58615
+ return {
58616
+ ...envelope,
58617
+ tips: {
58618
+ ...readStringRecord(envelope.tips),
58619
+ ...readStringRecord(receiverTips)
58620
+ }
58621
+ };
58622
+ }
58598
58623
  function buildA2AEnvelope(params) {
58599
58624
  const envelope = {
58600
58625
  msgType: A2A_MESSAGE_TYPE,
@@ -60441,7 +60466,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
60441
60466
  client: {
60442
60467
  id: "gateway-client",
60443
60468
  displayName: "okx-a2a-node",
60444
- version: "0.2.6-beta-5b74111b38-260814145826",
60469
+ version: "0.2.6",
60445
60470
  platform: "node",
60446
60471
  mode: "backend",
60447
60472
  instanceId
@@ -60452,7 +60477,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
60452
60477
  commands: [],
60453
60478
  permissions: {},
60454
60479
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
60455
- userAgent: `okx-a2a-node/${"0.2.6-beta-5b74111b38-260814145826"}`,
60480
+ userAgent: `okx-a2a-node/${"0.2.6"}`,
60456
60481
  auth: {
60457
60482
  ...config.token ? { token: config.token } : {},
60458
60483
  ...config.password ? { password: config.password } : {}
@@ -64450,11 +64475,11 @@ function extractXmtpSentAtMs2(msg) {
64450
64475
  }
64451
64476
  return Date.now();
64452
64477
  }
64453
- function parsePayload(rawText) {
64478
+ function parseJson2(rawText) {
64454
64479
  try {
64455
- return { parsed: true, payload: JSON.parse(rawText) };
64480
+ return { ok: true, data: JSON.parse(rawText) };
64456
64481
  } catch {
64457
- return { parsed: false, payload: null };
64482
+ return { ok: false, data: null };
64458
64483
  }
64459
64484
  }
64460
64485
  function readString3(value) {
@@ -65372,10 +65397,21 @@ async function processFileMessage(ctx, deps, options = {}) {
65372
65397
  }
65373
65398
  }
65374
65399
  const parseStartedAt = Date.now();
65375
- const rawText = extractRawText(ctx.message.content);
65376
- const parsed = parsePayload(rawText);
65400
+ const receivedRawText = extractRawText(ctx.message.content);
65401
+ const parseResult = parseJson2(receivedRawText);
65402
+ let rawText = receivedRawText;
65403
+ if (parseResult.ok) {
65404
+ const mergedPayload = mergeA2AEnvelopeTips(
65405
+ parseResult.data,
65406
+ XmtpService.getInstance().getSystemConfig().extConfig.tips
65407
+ );
65408
+ if (mergedPayload !== parseResult.data) {
65409
+ parseResult.data = mergedPayload;
65410
+ rawText = stringifySystemPayload(mergedPayload);
65411
+ }
65412
+ }
65377
65413
  timing.mark("payloadParse", parseStartedAt);
65378
- const directToUser = chatType === "dm" && parsed.parsed ? extractDirectToUserNotification(parsed.payload) : { kind: "none" };
65414
+ const directToUser = chatType === "dm" && parseResult.ok ? extractDirectToUserNotification(parseResult.data) : { kind: "none" };
65379
65415
  if (directToUser.kind === "invalid") {
65380
65416
  const droppedMessageId = messageId || `direct-to-user-${(0, import_node_crypto12.randomUUID)()}`;
65381
65417
  logger.error(
@@ -65407,7 +65443,7 @@ async function processFileMessage(ctx, deps, options = {}) {
65407
65443
  });
65408
65444
  return true;
65409
65445
  }
65410
- const systemNotification = chatType === "dm" && parsed.parsed ? extractSystemNotification(parsed.payload) : null;
65446
+ const systemNotification = chatType === "dm" && parseResult.ok ? extractSystemNotification(parseResult.data) : null;
65411
65447
  if (systemNotification) {
65412
65448
  const systemMessageId = messageId || `system-${(0, import_node_crypto12.randomUUID)()}`;
65413
65449
  logWithTimestamp(
@@ -65515,7 +65551,7 @@ async function processFileMessage(ctx, deps, options = {}) {
65515
65551
  maybeNotifyInboundAgentMessage({
65516
65552
  deps,
65517
65553
  chatType,
65518
- payload: parsed.payload,
65554
+ payload: parseResult.data,
65519
65555
  jobId: systemNotification.jobId ?? BACKUP_JOB_ID,
65520
65556
  sessionKey: primaryTarget?.sessionKey ?? SYSTEM_NOTIFICATION_SESSION_KEY,
65521
65557
  messageId: systemMessageId
@@ -65560,13 +65596,13 @@ async function processFileMessage(ctx, deps, options = {}) {
65560
65596
  }));
65561
65597
  });
65562
65598
  logWithTimestamp(
65563
- `[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=system/${target.route} session=${target.sessionKey} message=${shortenLogValue(systemMessageId)} ${summarizePayloadForLog(parsed.payload)}`
65599
+ `[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=system/${target.route} session=${target.sessionKey} message=${shortenLogValue(systemMessageId)} ${summarizePayloadForLog(parseResult.data)}`
65564
65600
  );
65565
65601
  }
65566
65602
  return true;
65567
65603
  }
65568
65604
  const routeStartedAt = Date.now();
65569
- const route = routeMessage(chatType, parsed.parsed, parsed.payload);
65605
+ const route = routeMessage(chatType, parseResult.ok, parseResult.data);
65570
65606
  timing.mark("routeResolve", routeStartedAt);
65571
65607
  if (route.route === "job") {
65572
65608
  const providerBindStartedAt = Date.now();
@@ -65592,7 +65628,7 @@ async function processFileMessage(ctx, deps, options = {}) {
65592
65628
  }
65593
65629
  const sessionAgentId = route.route === "job" ? resolveSessionAgentId({
65594
65630
  chatType,
65595
- payload: parsed.parsed ? parsed.payload : null,
65631
+ payload: parseResult.ok ? parseResult.data : null,
65596
65632
  myXmtpAddress: deps.myXmtpAddress
65597
65633
  }) : null;
65598
65634
  const xmtpSentAtMs = extractXmtpSentAtMs2(ctx.message);
@@ -65608,7 +65644,7 @@ async function processFileMessage(ctx, deps, options = {}) {
65608
65644
  );
65609
65645
  }
65610
65646
  if (route.route === "job" && chatType === "group") {
65611
- const payloadObject = isPlainObject3(parsed.parsed ? parsed.payload : null) ? parsed.payload : null;
65647
+ const payloadObject = isPlainObject3(parseResult.ok ? parseResult.data : null) ? parseResult.data : null;
65612
65648
  const service = XmtpService.getInstance();
65613
65649
  const trustedSystemSender = service.isTrustedSystemAccountSender({
65614
65650
  senderAddress,
@@ -65639,7 +65675,7 @@ async function processFileMessage(ctx, deps, options = {}) {
65639
65675
  const myAgentId = localAgent?.agentId ?? readString3(payloadObject?.receiverAgentId) ?? sessionAgentId ?? null;
65640
65676
  const toAgentId = readString3(sender?.agentId);
65641
65677
  const accepted = await verifyInboundA2AGroupMessage({
65642
- payload: parsed.parsed ? parsed.payload : null,
65678
+ payload: parseResult.ok ? parseResult.data : null,
65643
65679
  myXmtpAddress: deps.myXmtpAddress,
65644
65680
  senderAddress,
65645
65681
  senderInboxId: ctx.message.senderInboxId ?? "",
@@ -65706,7 +65742,7 @@ async function processFileMessage(ctx, deps, options = {}) {
65706
65742
  maybeNotifyInboundAgentMessage({
65707
65743
  deps,
65708
65744
  chatType,
65709
- payload: parsed.payload,
65745
+ payload: parseResult.data,
65710
65746
  jobId: route.jobId,
65711
65747
  sessionKey,
65712
65748
  messageId: routedMessageId,
@@ -65715,7 +65751,7 @@ async function processFileMessage(ctx, deps, options = {}) {
65715
65751
  }
65716
65752
  void maybeAllowProviderGroup(deps, chatType, conversationId);
65717
65753
  logWithTimestamp(
65718
- `[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=group session=${sessionKey} message=${shortenLogValue(routedMessageId)} ${summarizePayloadForLog(parsed.payload)}`
65754
+ `[okx-agent-task:${deps.myXmtpAddress}] session dispatch queued route=group session=${sessionKey} message=${shortenLogValue(routedMessageId)} ${summarizePayloadForLog(parseResult.data)}`
65719
65755
  );
65720
65756
  return true;
65721
65757
  }
@@ -65732,12 +65768,12 @@ async function processFileMessage(ctx, deps, options = {}) {
65732
65768
  senderInboxId: ctx.message.senderInboxId ?? "",
65733
65769
  conversationId,
65734
65770
  rawText,
65735
- payload: parsed.parsed ? parsed.payload : null
65771
+ payload: parseResult.ok ? parseResult.data : null
65736
65772
  };
65737
65773
  const storeAppendStartedAt = Date.now();
65738
65774
  await deps.store.append(route.jobId, stored, sessionAgentId);
65739
65775
  timing.mark("storeAppend", storeAppendStartedAt);
65740
- if ((route.route === "job" || parsed.parsed && !isA2AEnvelope(stored.payload)) && !options.skipNotify) {
65776
+ if ((route.route === "job" || parseResult.ok && !isA2AEnvelope(stored.payload)) && !options.skipNotify) {
65741
65777
  const payloadObject = isPlainObject3(stored.payload) ? stored.payload : null;
65742
65778
  const sender = isPlainObject3(payloadObject?.sender) ? payloadObject.sender : null;
65743
65779
  const localAgent = XmtpService.getInstance().getAgentByAddress(deps.myXmtpAddress);
@@ -66628,12 +66664,12 @@ async function runListenerWithLock(options, paths) {
66628
66664
  });
66629
66665
  }
66630
66666
  });
66631
- service.setPluginVersion("0.2.6-beta-5b74111b38-260814145826");
66667
+ service.setPluginVersion("0.2.6");
66632
66668
  await service.init();
66633
66669
  const pluginVersionStatus = service.pluginVersionStatus;
66634
66670
  if (pluginVersionStatus.unavailable) {
66635
66671
  throw new Error(
66636
- `@okxweb3/a2a-node v${"0.2.6-beta-5b74111b38-260814145826"} is below the required minimum v${pluginVersionStatus.minVersion}`
66672
+ `@okxweb3/a2a-node v${"0.2.6"} is below the required minimum v${pluginVersionStatus.minVersion}`
66637
66673
  );
66638
66674
  }
66639
66675
  const systemConfig = service.getSystemConfig();
@@ -66651,7 +66687,7 @@ async function runListenerWithLock(options, paths) {
66651
66687
  onchainosAgentId: "*",
66652
66688
  reason: "system-config missing sentryDsn",
66653
66689
  pluginId: "@okxweb3/a2a-node",
66654
- pluginVersion: "0.2.6-beta-5b74111b38-260814145826"
66690
+ pluginVersion: "0.2.6"
66655
66691
  });
66656
66692
  }
66657
66693
  logWithTimestamp(
@@ -69349,7 +69385,7 @@ async function exportDiagnosticLogs(options) {
69349
69385
  node: process.version,
69350
69386
  platform: process.platform,
69351
69387
  arch: process.arch,
69352
- packageVersion: true ? "0.2.6-beta-5b74111b38-260814145826" : "unknown",
69388
+ packageVersion: true ? "0.2.6" : "unknown",
69353
69389
  sensitiveContentIncluded: options.includeSensitiveContent,
69354
69390
  listenerAndLlmContentIncluded: true,
69355
69391
  credentialsAlwaysRedacted: true,
@@ -70649,7 +70685,10 @@ var providerBindingChecker = {
70649
70685
  }
70650
70686
  }
70651
70687
  };
70652
- function resolveProviderCliTarget(env, store) {
70688
+ function resolveProviderCliTarget(env, target, store) {
70689
+ if (target === "hermes") {
70690
+ return "hermes";
70691
+ }
70653
70692
  const runtime = detectRuntime(env);
70654
70693
  if (runtime === "codex" || runtime === "claude") {
70655
70694
  return runtime;
@@ -70660,10 +70699,10 @@ function resolveProviderCliTarget(env, store) {
70660
70699
  const storedDefault = store.getDefaultAiProvider();
70661
70700
  return storedDefault === "codex" || storedDefault === "claude" ? storedDefault : null;
70662
70701
  }
70663
- function readProviderCliTarget(env) {
70702
+ function readProviderCliTarget(env, target) {
70664
70703
  const store = new SessionStore();
70665
70704
  try {
70666
- const provider = resolveProviderCliTarget(env, store);
70705
+ const provider = resolveProviderCliTarget(env, target, store);
70667
70706
  return {
70668
70707
  provider,
70669
70708
  storedCommand: provider ? store.getAiProviderCommand(provider) : null
@@ -70676,12 +70715,26 @@ var providerCliChecker = {
70676
70715
  id: "provider_cli",
70677
70716
  title: "AI provider CLI",
70678
70717
  run: async (ctx) => {
70679
- const { provider, storedCommand } = readProviderCliTarget(ctx.env);
70718
+ const { provider, storedCommand } = readProviderCliTarget(ctx.env, ctx.target);
70680
70719
  if (!provider) {
70681
70720
  return null;
70682
70721
  }
70683
70722
  const resolved = provider === "codex" ? resolveCodexCommandPath(ctx.env, storedCommand, ctx.platform) : resolveCommandPath(resolveAiProviderCommand(provider, ctx.env, storedCommand, ctx.platform), ctx.env, ctx.platform);
70684
70723
  if (!resolved) {
70724
+ if (provider === "hermes") {
70725
+ return {
70726
+ id: "provider_cli",
70727
+ title: "AI provider CLI",
70728
+ status: "fail",
70729
+ severity: "required",
70730
+ detail: "hermes CLI is not installed or not usable on this machine",
70731
+ fix: {
70732
+ kind: "manual",
70733
+ description: "Install or repair the Hermes CLI, ensure the `hermes` executable is on PATH, then re-run okx-a2a doctor."
70734
+ },
70735
+ data: { provider }
70736
+ };
70737
+ }
70685
70738
  const spec = provider === "codex" ? CODEX_INSTALL_SPEC : CLAUDE_INSTALL_SPEC;
70686
70739
  return {
70687
70740
  id: "provider_cli",
@@ -70697,6 +70750,16 @@ var providerCliChecker = {
70697
70750
  data: { provider }
70698
70751
  };
70699
70752
  }
70753
+ if (provider === "hermes") {
70754
+ return {
70755
+ id: "provider_cli",
70756
+ title: "AI provider CLI",
70757
+ status: "pass",
70758
+ severity: "required",
70759
+ detail: "hermes CLI is installed and usable",
70760
+ data: { provider, command: resolved }
70761
+ };
70762
+ }
70700
70763
  const auth = provider === "codex" ? await checkCodexCliAuthStatus(resolved) : await checkClaudeCliAuthStatus(resolved);
70701
70764
  if (auth.ok) {
70702
70765
  if (provider === "codex" && ctx.env.OKX_A2A_AI_CODEX_COMMAND && storedCommand !== resolved) {
@@ -70750,8 +70813,8 @@ var providerCliChecker = {
70750
70813
  };
70751
70814
  },
70752
70815
  applyFix: async (ctx) => {
70753
- const { provider, storedCommand } = readProviderCliTarget(ctx.env);
70754
- if (!provider) {
70816
+ const { provider, storedCommand } = readProviderCliTarget(ctx.env, ctx.target);
70817
+ if (!provider || provider === "hermes") {
70755
70818
  throw new Error("no codex/claude runtime detected and no codex/claude provider bound");
70756
70819
  }
70757
70820
  const resolveCli = () => provider === "codex" ? resolveCodexCommandPath(ctx.env, storedCommand, ctx.platform) : resolveCommandPath(resolveAiProviderCommand(provider, ctx.env, storedCommand, ctx.platform), ctx.env, ctx.platform);
@@ -71185,7 +71248,7 @@ async function runDoctor(options = {}) {
71185
71248
  platform: options.platform ?? process.platform,
71186
71249
  env: options.env ?? process.env,
71187
71250
  target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
71188
- cliVersion: options.cliVersion ?? (true ? "0.2.6-beta-5b74111b38-260814145826" : "0.0.0"),
71251
+ cliVersion: options.cliVersion ?? (true ? "0.2.6" : "0.0.0"),
71189
71252
  fixMode: options.fix === true,
71190
71253
  nonInteractive: options.nonInteractive === true,
71191
71254
  packageChanged: false,
@@ -71570,6 +71633,7 @@ init_autostart_windows();
71570
71633
  logWinCompat,
71571
71634
  logXmtpMessageSent,
71572
71635
  maybeRecommendOnchainosUpgrade,
71636
+ mergeA2AEnvelopeTips,
71573
71637
  messageEligibleHelpAdvertisesOfflineReplay,
71574
71638
  nodeVersionSatisfies,
71575
71639
  normalizeAiProvider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okxweb3/a2a-node",
3
- "version": "0.2.6-beta-5b74111b38-260814145826",
3
+ "version": "0.2.6",
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": {