@okxweb3/a2a-node 0.1.1 → 0.1.2-beta-3bdae0ceae-260630212021

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.
package/dist/cli.js CHANGED
@@ -7852,7 +7852,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
7852
7852
  client: {
7853
7853
  id: "gateway-client",
7854
7854
  displayName: "okx-a2a-node",
7855
- version: "0.1.1",
7855
+ version: "0.1.2-beta-3bdae0ceae-260630212021",
7856
7856
  platform: "node",
7857
7857
  mode: "backend",
7858
7858
  instanceId
@@ -7863,7 +7863,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
7863
7863
  commands: [],
7864
7864
  permissions: {},
7865
7865
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
7866
- userAgent: `okx-a2a-node/${"0.1.1"}`,
7866
+ userAgent: `okx-a2a-node/${"0.1.2-beta-3bdae0ceae-260630212021"}`,
7867
7867
  auth: {
7868
7868
  ...config.token ? { token: config.token } : {},
7869
7869
  ...config.password ? { password: config.password } : {}
@@ -25082,7 +25082,7 @@ var init_sentry_config = __esm({
25082
25082
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
25083
25083
  SENTRY_CONFIG = {
25084
25084
  projectName: "okx/openclaw-okx-a2a-extension",
25085
- release: "0.1.1",
25085
+ release: "0.1.2-beta-3bdae0ceae-260630212021",
25086
25086
  environment
25087
25087
  };
25088
25088
  }
@@ -93065,12 +93065,12 @@ async function runListenerWithLock(options, paths) {
93065
93065
  }));
93066
93066
  }
93067
93067
  });
93068
- service.setPluginVersion("0.1.1");
93068
+ service.setPluginVersion("0.1.2-beta-3bdae0ceae-260630212021");
93069
93069
  await service.init();
93070
93070
  const pluginVersionStatus = service.pluginVersionStatus;
93071
93071
  if (pluginVersionStatus.unavailable) {
93072
93072
  throw new Error(
93073
- `@okxweb3/a2a-node v${"0.1.1"} is below the required minimum v${pluginVersionStatus.minVersion}`
93073
+ `@okxweb3/a2a-node v${"0.1.2-beta-3bdae0ceae-260630212021"} is below the required minimum v${pluginVersionStatus.minVersion}`
93074
93074
  );
93075
93075
  }
93076
93076
  const systemConfig = service.getSystemConfig();
@@ -93088,7 +93088,7 @@ async function runListenerWithLock(options, paths) {
93088
93088
  onchainosAgentId: "*",
93089
93089
  reason: "system-config missing sentryDsn",
93090
93090
  pluginId: "@okxweb3/a2a-node",
93091
- pluginVersion: "0.1.1"
93091
+ pluginVersion: "0.1.2-beta-3bdae0ceae-260630212021"
93092
93092
  });
93093
93093
  }
93094
93094
  logWithTimestamp(
@@ -96161,6 +96161,12 @@ async function handleSetupJson(args) {
96161
96161
  `);
96162
96162
  } catch (error) {
96163
96163
  console.log = originalLog;
96164
+ if (error instanceof SetupBlockedError) {
96165
+ process.stdout.write(`${JSON.stringify(error.result)}
96166
+ `);
96167
+ process.exitCode = 2;
96168
+ return;
96169
+ }
96164
96170
  const message = error instanceof Error ? error.message : String(error);
96165
96171
  const state = isSetupNeedsUserActionMessage(message) ? "needs_user_action" : "failed";
96166
96172
  const result = {
@@ -96193,6 +96199,7 @@ async function runSetup(options) {
96193
96199
  const runtime = detectRuntime();
96194
96200
  if (runtime === "codex" || runtime === "claude") {
96195
96201
  switchDefaultProviderForSetup(runtime);
96202
+ await ensureAiCliAuthReadyForSetup(runtime, resolvedTarget, releasePlan.resultRelease);
96196
96203
  }
96197
96204
  if (nodeChange.nodeChanged && (runtime === "codex" || runtime === "claude")) {
96198
96205
  await restartNodeDaemonAfterNodeSetup();
@@ -96310,6 +96317,104 @@ function switchDefaultProviderForSetup(provider) {
96310
96317
  store.close();
96311
96318
  }
96312
96319
  }
96320
+ async function ensureAiCliAuthReadyForSetup(provider, target, release) {
96321
+ let command = resolveAiProviderCommand(provider);
96322
+ const status = provider === "claude" ? await checkClaudeCliAuthStatus(command) : await checkCodexCliAuthStatus(command);
96323
+ if (status.ok) {
96324
+ console.log(`[setup] ${provider} CLI auth status is ready`);
96325
+ return;
96326
+ }
96327
+ if (status.reason === "provider_cli_missing") {
96328
+ await installAiProviderCliForSetup(provider);
96329
+ command = resolveAiProviderCommand(provider);
96330
+ }
96331
+ await runAiProviderLoginForSetup(provider, command, target, release);
96332
+ const verified = provider === "claude" ? await checkClaudeCliAuthStatus(command) : await checkCodexCliAuthStatus(command);
96333
+ if (verified.ok) {
96334
+ console.log(`[setup] ${provider} CLI auth status is ready after login`);
96335
+ return;
96336
+ }
96337
+ throw buildAiCliAuthBlockedError(provider, target, release, verified.reason, verified.detail);
96338
+ }
96339
+ function aiProviderCliInstallSpec(provider) {
96340
+ return provider === "claude" ? "@anthropic-ai/claude-code" : "@openai/codex";
96341
+ }
96342
+ async function installAiProviderCliForSetup(provider) {
96343
+ const spec = aiProviderCliInstallSpec(provider);
96344
+ console.log(`[setup] installing ${spec}`);
96345
+ await runCommand("npm", ["install", "-g", spec]);
96346
+ console.log(`[setup] ${provider} CLI install done`);
96347
+ }
96348
+ async function runAiProviderLoginForSetup(provider, command, target, release) {
96349
+ const args = provider === "claude" ? ["auth", "login"] : ["login", "--device-auth"];
96350
+ console.log(`[setup] running ${provider} CLI login`);
96351
+ try {
96352
+ await runCommand(command, args, { inheritStdin: true });
96353
+ } catch (error) {
96354
+ const message = error instanceof Error ? error.message : String(error);
96355
+ throw buildAiCliAuthBlockedError(provider, target, release, "provider_cli_login_failed", message);
96356
+ }
96357
+ }
96358
+ function buildAiCliAuthBlockedError(provider, target, release, reason, detail) {
96359
+ const installCommand = provider === "claude" ? "npm install -g @anthropic-ai/claude-code" : "npm install -g @openai/codex";
96360
+ const nextCommand = provider === "claude" ? "claude auth login" : "codex login --device-auth";
96361
+ const verifyCommand = provider === "claude" ? "claude auth status --json" : "codex login status";
96362
+ const providerLabel = provider === "claude" ? "Claude Code" : "Codex";
96363
+ const missing = reason === "provider_cli_missing";
96364
+ const loginFailed = reason === "provider_cli_login_failed";
96365
+ const commandText = missing ? `${installCommand} && ${nextCommand}` : nextCommand;
96366
+ const detailText = detail ? `
96367
+
96368
+ Detail:
96369
+ ${detail}` : "";
96370
+ return new SetupBlockedError({
96371
+ ok: false,
96372
+ state: "blocked",
96373
+ target,
96374
+ release,
96375
+ reason,
96376
+ installCommand: missing ? installCommand : void 0,
96377
+ nextCommand,
96378
+ verifyCommand,
96379
+ userMessage: [
96380
+ `${providerLabel} CLI ${loginFailed ? "login did not complete" : `is ${missing ? "not installed or not on PATH" : "not logged in"}`}.`,
96381
+ "Your GUI session may be active, but OKX A2A uses the local CLI credential store.",
96382
+ `Setup tried to run the login flow. If the browser or device login did not finish, run this in your own local terminal: ${commandText}`,
96383
+ `Then rerun: okx-a2a setup --json`
96384
+ ].join(" "),
96385
+ detail: detailText.trim() || void 0
96386
+ });
96387
+ }
96388
+ async function checkClaudeCliAuthStatus(command) {
96389
+ const result = await runCommandCaptureStatus(command, ["auth", "status", "--json"]);
96390
+ if (result.errorCode === "ENOENT") {
96391
+ return { ok: false, reason: "provider_cli_missing", detail: result.detail };
96392
+ }
96393
+ if (result.code !== 0) {
96394
+ return { ok: false, reason: "provider_cli_not_logged_in", detail: result.detail };
96395
+ }
96396
+ try {
96397
+ const payload = JSON.parse(result.stdout);
96398
+ if (payload.loggedIn === true) {
96399
+ return { ok: true };
96400
+ }
96401
+ return { ok: false, reason: "provider_cli_not_logged_in", detail: result.stdout.trim() || result.detail };
96402
+ } catch (error) {
96403
+ const message = error instanceof Error ? error.message : String(error);
96404
+ return { ok: false, reason: "provider_cli_auth_status_invalid", detail: `${message}
96405
+ ${result.stdout}`.trim() };
96406
+ }
96407
+ }
96408
+ async function checkCodexCliAuthStatus(command) {
96409
+ const result = await runCommandCaptureStatus(command, ["login", "status"]);
96410
+ if (result.errorCode === "ENOENT") {
96411
+ return { ok: false, reason: "provider_cli_missing", detail: result.detail };
96412
+ }
96413
+ if (result.code === 0) {
96414
+ return { ok: true };
96415
+ }
96416
+ return { ok: false, reason: "provider_cli_not_logged_in", detail: result.detail };
96417
+ }
96313
96418
  function logSetupChangeState(target, changes) {
96314
96419
  console.log(
96315
96420
  `[setup] ${target} desiredGateway=${changes.desiredGatewayVersion} desiredNode=${changes.desiredNodeVersion ?? "(preserved)"} installedGateway=${changes.gatewayVersion ?? "(not installed)"} installedNode=${changes.nodeVersion ?? "(not installed)"} configChanged=${changes.configChanged ? "yes" : "no"}`
@@ -96376,7 +96481,7 @@ async function getCurrentNodeCliVersion() {
96376
96481
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
96377
96482
  }
96378
96483
  function getBundledNodeCliVersion() {
96379
- return true ? "0.1.1" : null;
96484
+ return true ? "0.1.2-beta-3bdae0ceae-260630212021" : null;
96380
96485
  }
96381
96486
  function readConfiguredAiProvider() {
96382
96487
  const explicit = process.env.OKX_AGENT_TASK_AI_CLI ?? process.env.OKX_A2A_AI_PROVIDER;
@@ -97110,7 +97215,7 @@ async function runCommand(command, args, options = {}) {
97110
97215
  await new Promise((resolvePromise, reject) => {
97111
97216
  const child = (0, import_node_child_process8.spawn)(command, args, {
97112
97217
  cwd: options.cwd,
97113
- stdio: redirectCommandStdoutToStderr ? ["ignore", "pipe", "pipe"] : "inherit"
97218
+ stdio: redirectCommandStdoutToStderr ? [options.inheritStdin ? "inherit" : "ignore", "pipe", "pipe"] : "inherit"
97114
97219
  });
97115
97220
  if (redirectCommandStdoutToStderr && child.stdout && child.stderr) {
97116
97221
  child.stdout.pipe(process.stderr);
@@ -97169,7 +97274,42 @@ async function runCommandCaptureOptional(command, args) {
97169
97274
  });
97170
97275
  });
97171
97276
  }
97172
- var import_node_child_process8, import_node_fs18, import_promises8, import_node_os9, import_node_path22, UPDATE_PACKAGES, OPENCLAW_FORCE_INSTALL_FLAG, OPENCLAW_UNSAFE_INSTALL_FLAG, OKX_A2A_PLUGIN_ID, OPENCLAW_SESSION_DM_SCOPE_CONFIG_PATH, OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE, OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH, OPENCLAW_OKX_A2A_CONVERSATION_HOOK_ACCESS_CONFIG_PATH, redirectCommandStdoutToStderr;
97277
+ async function runCommandCaptureStatus(command, args) {
97278
+ return await new Promise((resolvePromise) => {
97279
+ const child = (0, import_node_child_process8.spawn)(command, args, { stdio: ["ignore", "pipe", "pipe"] });
97280
+ let stdout = "";
97281
+ let stderr = "";
97282
+ child.stdout.setEncoding("utf8");
97283
+ child.stderr.setEncoding("utf8");
97284
+ child.stdout.on("data", (chunk) => {
97285
+ stdout += chunk;
97286
+ });
97287
+ child.stderr.on("data", (chunk) => {
97288
+ stderr += chunk;
97289
+ });
97290
+ child.on("error", (error) => {
97291
+ const detail = error.message;
97292
+ resolvePromise({
97293
+ code: null,
97294
+ stdout,
97295
+ stderr,
97296
+ detail,
97297
+ errorCode: error.code
97298
+ });
97299
+ });
97300
+ child.on("close", (code2, signal) => {
97301
+ const signalDetail = signal ? `signal=${signal}` : "";
97302
+ const detail = [stderr.trim(), stdout.trim(), signalDetail].filter(Boolean).join("\n");
97303
+ resolvePromise({
97304
+ code: code2,
97305
+ stdout,
97306
+ stderr,
97307
+ detail
97308
+ });
97309
+ });
97310
+ });
97311
+ }
97312
+ var import_node_child_process8, import_node_fs18, import_promises8, import_node_os9, import_node_path22, UPDATE_PACKAGES, OPENCLAW_FORCE_INSTALL_FLAG, OPENCLAW_UNSAFE_INSTALL_FLAG, OKX_A2A_PLUGIN_ID, OPENCLAW_SESSION_DM_SCOPE_CONFIG_PATH, OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE, OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH, OPENCLAW_OKX_A2A_CONVERSATION_HOOK_ACCESS_CONFIG_PATH, SetupBlockedError, redirectCommandStdoutToStderr;
97173
97313
  var init_update_cli = __esm({
97174
97314
  "src/update-cli.ts"() {
97175
97315
  "use strict";
@@ -97178,6 +97318,7 @@ var init_update_cli = __esm({
97178
97318
  import_promises8 = require("node:fs/promises");
97179
97319
  import_node_os9 = require("node:os");
97180
97320
  import_node_path22 = require("node:path");
97321
+ init_ai_command();
97181
97322
  init_ai_provider();
97182
97323
  init_session_store();
97183
97324
  UPDATE_PACKAGES = {
@@ -97192,6 +97333,14 @@ var init_update_cli = __esm({
97192
97333
  OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE = "per-channel-peer";
97193
97334
  OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH = "plugins.allow";
97194
97335
  OPENCLAW_OKX_A2A_CONVERSATION_HOOK_ACCESS_CONFIG_PATH = "plugins.entries.okx-a2a.hooks.allowConversationAccess";
97336
+ SetupBlockedError = class extends Error {
97337
+ result;
97338
+ constructor(result) {
97339
+ super(result.userMessage ?? "OKX A2A setup needs user action.");
97340
+ this.name = "SetupBlockedError";
97341
+ this.result = result;
97342
+ }
97343
+ };
97195
97344
  redirectCommandStdoutToStderr = false;
97196
97345
  }
97197
97346
  });
@@ -97214,7 +97363,7 @@ init_sentry_logger();
97214
97363
  init_sentry_config();
97215
97364
  var CURRENT_GATEWAY_SESSION_KEYS_ENV3 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
97216
97365
  function printUsage2() {
97217
- console.log(`okx-a2a ${"0.1.1"}
97366
+ console.log(`okx-a2a ${"0.1.2-beta-3bdae0ceae-260630212021"}
97218
97367
 
97219
97368
  Usage:
97220
97369
  okx-a2a <command> [options]
@@ -97251,7 +97400,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
97251
97400
  `);
97252
97401
  }
97253
97402
  function printVersion() {
97254
- console.log("0.1.1");
97403
+ console.log("0.1.2-beta-3bdae0ceae-260630212021");
97255
97404
  }
97256
97405
  function printDaemonUsage() {
97257
97406
  console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
package/dist/index.js CHANGED
@@ -86724,7 +86724,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
86724
86724
  client: {
86725
86725
  id: "gateway-client",
86726
86726
  displayName: "okx-a2a-node",
86727
- version: "0.1.1",
86727
+ version: "0.1.2-beta-3bdae0ceae-260630212021",
86728
86728
  platform: "node",
86729
86729
  mode: "backend",
86730
86730
  instanceId
@@ -86735,7 +86735,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
86735
86735
  commands: [],
86736
86736
  permissions: {},
86737
86737
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
86738
- userAgent: `okx-a2a-node/${"0.1.1"}`,
86738
+ userAgent: `okx-a2a-node/${"0.1.2-beta-3bdae0ceae-260630212021"}`,
86739
86739
  auth: {
86740
86740
  ...config.token ? { token: config.token } : {},
86741
86741
  ...config.password ? { password: config.password } : {}
@@ -91154,7 +91154,7 @@ function userWatchEventDeliveredSentryExtra(event) {
91154
91154
  var environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
91155
91155
  var SENTRY_CONFIG = {
91156
91156
  projectName: "okx/openclaw-okx-a2a-extension",
91157
- release: "0.1.1",
91157
+ release: "0.1.2-beta-3bdae0ceae-260630212021",
91158
91158
  environment
91159
91159
  };
91160
91160
 
@@ -91381,12 +91381,12 @@ async function runListenerWithLock(options, paths) {
91381
91381
  }));
91382
91382
  }
91383
91383
  });
91384
- service.setPluginVersion("0.1.1");
91384
+ service.setPluginVersion("0.1.2-beta-3bdae0ceae-260630212021");
91385
91385
  await service.init();
91386
91386
  const pluginVersionStatus = service.pluginVersionStatus;
91387
91387
  if (pluginVersionStatus.unavailable) {
91388
91388
  throw new Error(
91389
- `@okxweb3/a2a-node v${"0.1.1"} is below the required minimum v${pluginVersionStatus.minVersion}`
91389
+ `@okxweb3/a2a-node v${"0.1.2-beta-3bdae0ceae-260630212021"} is below the required minimum v${pluginVersionStatus.minVersion}`
91390
91390
  );
91391
91391
  }
91392
91392
  const systemConfig = service.getSystemConfig();
@@ -91404,7 +91404,7 @@ async function runListenerWithLock(options, paths) {
91404
91404
  onchainosAgentId: "*",
91405
91405
  reason: "system-config missing sentryDsn",
91406
91406
  pluginId: "@okxweb3/a2a-node",
91407
- pluginVersion: "0.1.1"
91407
+ pluginVersion: "0.1.2-beta-3bdae0ceae-260630212021"
91408
91408
  });
91409
91409
  }
91410
91410
  logWithTimestamp(
@@ -92063,7 +92063,7 @@ async function runCommand(command, args, options = {}) {
92063
92063
  await new Promise((resolvePromise, reject) => {
92064
92064
  const child = (0, import_node_child_process6.spawn)(command, args, {
92065
92065
  cwd: options.cwd,
92066
- stdio: redirectCommandStdoutToStderr ? ["ignore", "pipe", "pipe"] : "inherit"
92066
+ stdio: redirectCommandStdoutToStderr ? [options.inheritStdin ? "inherit" : "ignore", "pipe", "pipe"] : "inherit"
92067
92067
  });
92068
92068
  if (redirectCommandStdoutToStderr && child.stdout && child.stderr) {
92069
92069
  child.stdout.pipe(process.stderr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okxweb3/a2a-node",
3
- "version": "0.1.1",
3
+ "version": "0.1.2-beta-3bdae0ceae-260630212021",
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": {