@okxweb3/a2a-node 0.1.4 → 0.1.5

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 +37 -21
  2. package/dist/index.js +33 -17
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -3376,11 +3376,25 @@ function switchProvider(options) {
3376
3376
  readParentProcessCommand: options.readParentProcessCommand
3377
3377
  });
3378
3378
  if (runtime === "unknown") {
3379
+ const stored = options.store.getDefaultAiProvider();
3380
+ if (stored) {
3381
+ return {
3382
+ ok: true,
3383
+ runtime: "unknown",
3384
+ provider: stored,
3385
+ previousProvider: stored,
3386
+ changed: false,
3387
+ action: "kept_existing",
3388
+ userMessage: `No AI runtime detected for the current environment; keeping the existing default provider (${formatAiProviderDisplayName(stored)}).`
3389
+ };
3390
+ }
3379
3391
  return {
3380
3392
  ok: false,
3381
3393
  runtime: "unknown",
3382
3394
  reason: "unknown_runtime",
3383
- message: "Could not determine the current AI provider."
3395
+ state: "blocked",
3396
+ message: "Could not determine the current AI provider.",
3397
+ userMessage: "Could not detect the current AI runtime and no default AI provider is configured. Run this from your AI environment (OpenClaw / Codex / Claude / Hermes), or set a provider manually: `okx-a2a ai-provider set --provider <codex|claude|hermes|openclaw>`."
3384
3398
  };
3385
3399
  }
3386
3400
  const previousProvider = options.store.getDefaultAiProvider();
@@ -3392,6 +3406,7 @@ function switchProvider(options) {
3392
3406
  provider: runtime,
3393
3407
  previousProvider,
3394
3408
  changed,
3409
+ action: "switched",
3395
3410
  userMessage: changed ? `Switched to ${formatAiProviderDisplayName(runtime)}\uFF5CNew tasks will be handled here; unfinished tasks should be continued in their original session` : ""
3396
3411
  };
3397
3412
  }
@@ -8278,7 +8293,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
8278
8293
  client: {
8279
8294
  id: "gateway-client",
8280
8295
  displayName: "okx-a2a-node",
8281
- version: "0.1.4",
8296
+ version: "0.1.5",
8282
8297
  platform: "node",
8283
8298
  mode: "backend",
8284
8299
  instanceId
@@ -8289,7 +8304,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
8289
8304
  commands: [],
8290
8305
  permissions: {},
8291
8306
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
8292
- userAgent: `okx-a2a-node/${"0.1.4"}`,
8307
+ userAgent: `okx-a2a-node/${"0.1.5"}`,
8293
8308
  auth: {
8294
8309
  ...config.token ? { token: config.token } : {},
8295
8310
  ...config.password ? { password: config.password } : {}
@@ -25545,7 +25560,7 @@ var init_sentry_config = __esm({
25545
25560
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
25546
25561
  SENTRY_CONFIG = {
25547
25562
  projectName: "okx/openclaw-okx-a2a-extension",
25548
- release: "0.1.4",
25563
+ release: "0.1.5",
25549
25564
  environment
25550
25565
  };
25551
25566
  }
@@ -85166,7 +85181,7 @@ function isAgentXmtpCommunicable(agent) {
85166
85181
  if (!agent) {
85167
85182
  return false;
85168
85183
  }
85169
- return XMTP_COMMUNICABLE_AGENT_STATUSES.has(Number(agent.status));
85184
+ return true;
85170
85185
  }
85171
85186
  function isAgentXmtpBlocked(agent) {
85172
85187
  if (!agent) {
@@ -85174,14 +85189,10 @@ function isAgentXmtpBlocked(agent) {
85174
85189
  }
85175
85190
  return XMTP_BLOCKED_AGENT_STATUSES.has(Number(agent.status));
85176
85191
  }
85177
- var XMTP_COMMUNICABLE_AGENT_STATUSES, XMTP_BLOCKED_AGENT_STATUSES;
85192
+ var XMTP_BLOCKED_AGENT_STATUSES;
85178
85193
  var init_agent_status = __esm({
85179
85194
  "../core/src/xmtp-sdk/onchainos/agent-status.ts"() {
85180
85195
  "use strict";
85181
- XMTP_COMMUNICABLE_AGENT_STATUSES = /* @__PURE__ */ new Set([
85182
- 1 /* ACTIVE */,
85183
- 2 /* USER_OFFLINE */
85184
- ]);
85185
85196
  XMTP_BLOCKED_AGENT_STATUSES = /* @__PURE__ */ new Set([
85186
85197
  3 /* SECURITY_BLACKLISTED */,
85187
85198
  4 /* RISK_BLACKLISTED */,
@@ -94055,12 +94066,12 @@ async function runListenerWithLock(options, paths) {
94055
94066
  }));
94056
94067
  }
94057
94068
  });
94058
- service.setPluginVersion("0.1.4");
94069
+ service.setPluginVersion("0.1.5");
94059
94070
  await service.init();
94060
94071
  const pluginVersionStatus = service.pluginVersionStatus;
94061
94072
  if (pluginVersionStatus.unavailable) {
94062
94073
  throw new Error(
94063
- `@okxweb3/a2a-node v${"0.1.4"} is below the required minimum v${pluginVersionStatus.minVersion}`
94074
+ `@okxweb3/a2a-node v${"0.1.5"} is below the required minimum v${pluginVersionStatus.minVersion}`
94064
94075
  );
94065
94076
  }
94066
94077
  const systemConfig = service.getSystemConfig();
@@ -94078,7 +94089,7 @@ async function runListenerWithLock(options, paths) {
94078
94089
  onchainosAgentId: "*",
94079
94090
  reason: "system-config missing sentryDsn",
94080
94091
  pluginId: "@okxweb3/a2a-node",
94081
- pluginVersion: "0.1.4"
94092
+ pluginVersion: "0.1.5"
94082
94093
  });
94083
94094
  }
94084
94095
  logWithTimestamp(
@@ -97873,7 +97884,7 @@ async function getCurrentNodeCliVersion() {
97873
97884
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
97874
97885
  }
97875
97886
  function getBundledNodeCliVersion() {
97876
- return true ? "0.1.4" : null;
97887
+ return true ? "0.1.5" : null;
97877
97888
  }
97878
97889
  function readConfiguredAiProvider() {
97879
97890
  const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
@@ -98064,7 +98075,7 @@ async function updateHermes(release, options) {
98064
98075
  }
98065
98076
  }
98066
98077
  async function installGatewayPluginForDoctor(target) {
98067
- const release = isPrereleaseVersion("0.1.4") ? "beta" : "latest";
98078
+ const release = isPrereleaseVersion("0.1.5") ? "beta" : "latest";
98068
98079
  const insideTargetGateway = detectGatewayInvocation() === target;
98069
98080
  const options = {
98070
98081
  restart: !insideTargetGateway,
@@ -99137,7 +99148,7 @@ async function runDoctor(options = {}) {
99137
99148
  platform: options.platform ?? process.platform,
99138
99149
  env: options.env ?? process.env,
99139
99150
  target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
99140
- cliVersion: options.cliVersion ?? (true ? "0.1.4" : "0.0.0"),
99151
+ cliVersion: options.cliVersion ?? (true ? "0.1.5" : "0.0.0"),
99141
99152
  fixMode: options.fix === true,
99142
99153
  packageChanged: false
99143
99154
  };
@@ -99552,13 +99563,18 @@ var init_doctor_cli = __esm({
99552
99563
  data: { bound, detectedRuntime: runtime }
99553
99564
  };
99554
99565
  }
99566
+ const autoFixCanSucceed = !!expected;
99555
99567
  return {
99556
99568
  id: "provider_binding",
99557
99569
  title: "Default AI provider binding",
99558
99570
  status: "fail",
99559
99571
  severity: "required",
99560
99572
  detail: bound ? `default provider ${bound} does not match the detected runtime ${runtime}` : "no default AI provider is bound",
99561
- fix: { kind: "auto", description: "Run the in-memory runtime switch (equivalent of `okx-a2a switch-runtime`)." },
99573
+ fix: autoFixCanSucceed ? { kind: "auto", description: "Run the in-memory runtime switch (equivalent of `okx-a2a switch-runtime`)." } : {
99574
+ kind: "manual",
99575
+ description: "No AI runtime detected and no default provider is bound. Run doctor from your AI environment (OpenClaw / Codex / Claude / Hermes), or bind one manually first.",
99576
+ command: "okx-a2a ai-provider set --provider <codex|claude|hermes|openclaw>"
99577
+ },
99562
99578
  data: { bound, detectedRuntime: runtime }
99563
99579
  };
99564
99580
  } finally {
@@ -99570,7 +99586,7 @@ var init_doctor_cli = __esm({
99570
99586
  try {
99571
99587
  const result = await performRuntimeSwitch(store);
99572
99588
  if (!result.ok) {
99573
- throw new Error(result.message || "runtime switch failed");
99589
+ throw new Error(result.userMessage || result.message || "runtime switch failed");
99574
99590
  }
99575
99591
  return `runtime switch: provider=${result.provider} ${result.changed ? "(switched)" : "(already current)"}`;
99576
99592
  } finally {
@@ -100209,7 +100225,7 @@ init_sentry_logger();
100209
100225
  init_sentry_config();
100210
100226
  var CURRENT_GATEWAY_SESSION_KEYS_ENV4 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
100211
100227
  function printUsage2() {
100212
- console.log(`okx-a2a ${"0.1.4"}
100228
+ console.log(`okx-a2a ${"0.1.5"}
100213
100229
 
100214
100230
  Usage:
100215
100231
  okx-a2a <command> [options]
@@ -100247,7 +100263,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
100247
100263
  `);
100248
100264
  }
100249
100265
  function printVersion() {
100250
- console.log("0.1.4");
100266
+ console.log("0.1.5");
100251
100267
  }
100252
100268
  function printDaemonUsage() {
100253
100269
  console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
@@ -101272,7 +101288,7 @@ async function handleRuntimeSwitch(args) {
101272
101288
  console.log(result.userMessage);
101273
101289
  }
101274
101290
  } else {
101275
- console.log(result.message);
101291
+ console.log(result.userMessage || result.message);
101276
101292
  }
101277
101293
  if (!result.ok) {
101278
101294
  process.exitCode = 1;
package/dist/index.js CHANGED
@@ -2228,11 +2228,25 @@ function switchProvider(options) {
2228
2228
  readParentProcessCommand: options.readParentProcessCommand
2229
2229
  });
2230
2230
  if (runtime === "unknown") {
2231
+ const stored = options.store.getDefaultAiProvider();
2232
+ if (stored) {
2233
+ return {
2234
+ ok: true,
2235
+ runtime: "unknown",
2236
+ provider: stored,
2237
+ previousProvider: stored,
2238
+ changed: false,
2239
+ action: "kept_existing",
2240
+ userMessage: `No AI runtime detected for the current environment; keeping the existing default provider (${formatAiProviderDisplayName(stored)}).`
2241
+ };
2242
+ }
2231
2243
  return {
2232
2244
  ok: false,
2233
2245
  runtime: "unknown",
2234
2246
  reason: "unknown_runtime",
2235
- message: "Could not determine the current AI provider."
2247
+ state: "blocked",
2248
+ message: "Could not determine the current AI provider.",
2249
+ userMessage: "Could not detect the current AI runtime and no default AI provider is configured. Run this from your AI environment (OpenClaw / Codex / Claude / Hermes), or set a provider manually: `okx-a2a ai-provider set --provider <codex|claude|hermes|openclaw>`."
2236
2250
  };
2237
2251
  }
2238
2252
  const previousProvider = options.store.getDefaultAiProvider();
@@ -2244,6 +2258,7 @@ function switchProvider(options) {
2244
2258
  provider: runtime,
2245
2259
  previousProvider,
2246
2260
  changed,
2261
+ action: "switched",
2247
2262
  userMessage: changed ? `Switched to ${formatAiProviderDisplayName(runtime)}\uFF5CNew tasks will be handled here; unfinished tasks should be continued in their original session` : ""
2248
2263
  };
2249
2264
  }
@@ -71610,7 +71625,7 @@ async function getCurrentNodeCliVersion() {
71610
71625
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
71611
71626
  }
71612
71627
  function getBundledNodeCliVersion() {
71613
- return true ? "0.1.4" : null;
71628
+ return true ? "0.1.5" : null;
71614
71629
  }
71615
71630
  function readConfiguredAiProvider() {
71616
71631
  const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
@@ -71801,7 +71816,7 @@ async function updateHermes(release, options) {
71801
71816
  }
71802
71817
  }
71803
71818
  async function installGatewayPluginForDoctor(target) {
71804
- const release = isPrereleaseVersion("0.1.4") ? "beta" : "latest";
71819
+ const release = isPrereleaseVersion("0.1.5") ? "beta" : "latest";
71805
71820
  const insideTargetGateway = detectGatewayInvocation() === target;
71806
71821
  const options = {
71807
71822
  restart: !insideTargetGateway,
@@ -86127,10 +86142,6 @@ function compareTimestamp(a, b) {
86127
86142
  }
86128
86143
 
86129
86144
  // ../core/src/xmtp-sdk/onchainos/agent-status.ts
86130
- var XMTP_COMMUNICABLE_AGENT_STATUSES = /* @__PURE__ */ new Set([
86131
- 1 /* ACTIVE */,
86132
- 2 /* USER_OFFLINE */
86133
- ]);
86134
86145
  var XMTP_BLOCKED_AGENT_STATUSES = /* @__PURE__ */ new Set([
86135
86146
  3 /* SECURITY_BLACKLISTED */,
86136
86147
  4 /* RISK_BLACKLISTED */,
@@ -86140,7 +86151,7 @@ function isAgentXmtpCommunicable(agent) {
86140
86151
  if (!agent) {
86141
86152
  return false;
86142
86153
  }
86143
- return XMTP_COMMUNICABLE_AGENT_STATUSES.has(Number(agent.status));
86154
+ return true;
86144
86155
  }
86145
86156
  function isAgentXmtpBlocked(agent) {
86146
86157
  if (!agent) {
@@ -89305,7 +89316,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
89305
89316
  client: {
89306
89317
  id: "gateway-client",
89307
89318
  displayName: "okx-a2a-node",
89308
- version: "0.1.4",
89319
+ version: "0.1.5",
89309
89320
  platform: "node",
89310
89321
  mode: "backend",
89311
89322
  instanceId
@@ -89316,7 +89327,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
89316
89327
  commands: [],
89317
89328
  permissions: {},
89318
89329
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
89319
- userAgent: `okx-a2a-node/${"0.1.4"}`,
89330
+ userAgent: `okx-a2a-node/${"0.1.5"}`,
89320
89331
  auth: {
89321
89332
  ...config.token ? { token: config.token } : {},
89322
89333
  ...config.password ? { password: config.password } : {}
@@ -93786,7 +93797,7 @@ init_ai_provider();
93786
93797
  var environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
93787
93798
  var SENTRY_CONFIG = {
93788
93799
  projectName: "okx/openclaw-okx-a2a-extension",
93789
- release: "0.1.4",
93800
+ release: "0.1.5",
93790
93801
  environment
93791
93802
  };
93792
93803
 
@@ -94013,12 +94024,12 @@ async function runListenerWithLock(options, paths) {
94013
94024
  }));
94014
94025
  }
94015
94026
  });
94016
- service.setPluginVersion("0.1.4");
94027
+ service.setPluginVersion("0.1.5");
94017
94028
  await service.init();
94018
94029
  const pluginVersionStatus = service.pluginVersionStatus;
94019
94030
  if (pluginVersionStatus.unavailable) {
94020
94031
  throw new Error(
94021
- `@okxweb3/a2a-node v${"0.1.4"} is below the required minimum v${pluginVersionStatus.minVersion}`
94032
+ `@okxweb3/a2a-node v${"0.1.5"} is below the required minimum v${pluginVersionStatus.minVersion}`
94022
94033
  );
94023
94034
  }
94024
94035
  const systemConfig = service.getSystemConfig();
@@ -94036,7 +94047,7 @@ async function runListenerWithLock(options, paths) {
94036
94047
  onchainosAgentId: "*",
94037
94048
  reason: "system-config missing sentryDsn",
94038
94049
  pluginId: "@okxweb3/a2a-node",
94039
- pluginVersion: "0.1.4"
94050
+ pluginVersion: "0.1.5"
94040
94051
  });
94041
94052
  }
94042
94053
  logWithTimestamp(
@@ -95312,13 +95323,18 @@ var providerBindingChecker = {
95312
95323
  data: { bound, detectedRuntime: runtime }
95313
95324
  };
95314
95325
  }
95326
+ const autoFixCanSucceed = !!expected;
95315
95327
  return {
95316
95328
  id: "provider_binding",
95317
95329
  title: "Default AI provider binding",
95318
95330
  status: "fail",
95319
95331
  severity: "required",
95320
95332
  detail: bound ? `default provider ${bound} does not match the detected runtime ${runtime}` : "no default AI provider is bound",
95321
- fix: { kind: "auto", description: "Run the in-memory runtime switch (equivalent of `okx-a2a switch-runtime`)." },
95333
+ fix: autoFixCanSucceed ? { kind: "auto", description: "Run the in-memory runtime switch (equivalent of `okx-a2a switch-runtime`)." } : {
95334
+ kind: "manual",
95335
+ description: "No AI runtime detected and no default provider is bound. Run doctor from your AI environment (OpenClaw / Codex / Claude / Hermes), or bind one manually first.",
95336
+ command: "okx-a2a ai-provider set --provider <codex|claude|hermes|openclaw>"
95337
+ },
95322
95338
  data: { bound, detectedRuntime: runtime }
95323
95339
  };
95324
95340
  } finally {
@@ -95330,7 +95346,7 @@ var providerBindingChecker = {
95330
95346
  try {
95331
95347
  const result = await performRuntimeSwitch(store);
95332
95348
  if (!result.ok) {
95333
- throw new Error(result.message || "runtime switch failed");
95349
+ throw new Error(result.userMessage || result.message || "runtime switch failed");
95334
95350
  }
95335
95351
  return `runtime switch: provider=${result.provider} ${result.changed ? "(switched)" : "(already current)"}`;
95336
95352
  } finally {
@@ -95759,7 +95775,7 @@ async function runDoctor(options = {}) {
95759
95775
  platform: options.platform ?? process.platform,
95760
95776
  env: options.env ?? process.env,
95761
95777
  target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
95762
- cliVersion: options.cliVersion ?? (true ? "0.1.4" : "0.0.0"),
95778
+ cliVersion: options.cliVersion ?? (true ? "0.1.5" : "0.0.0"),
95763
95779
  fixMode: options.fix === true,
95764
95780
  packageChanged: false
95765
95781
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okxweb3/a2a-node",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
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": {