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

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 +224 -44
  2. package/dist/index.js +36 -10
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2822,7 +2822,10 @@ function resolveAiProviderCommand(provider, env = process.env) {
2822
2822
  if (override) {
2823
2823
  return override;
2824
2824
  }
2825
- return findExecutable(provider, env) ?? provider;
2825
+ return resolveCommandPath(provider, env) ?? provider;
2826
+ }
2827
+ function resolveCommandPath(command, env = process.env) {
2828
+ return findExecutable(command, env);
2826
2829
  }
2827
2830
  function commandExists(command, env = process.env) {
2828
2831
  if (isExecutable(command)) {
@@ -7852,7 +7855,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
7852
7855
  client: {
7853
7856
  id: "gateway-client",
7854
7857
  displayName: "okx-a2a-node",
7855
- version: "0.1.2-beta-3bdae0ceae-260630212021",
7858
+ version: "0.1.2-beta-3bdae0ceae-260701000928",
7856
7859
  platform: "node",
7857
7860
  mode: "backend",
7858
7861
  instanceId
@@ -7863,7 +7866,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
7863
7866
  commands: [],
7864
7867
  permissions: {},
7865
7868
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
7866
- userAgent: `okx-a2a-node/${"0.1.2-beta-3bdae0ceae-260630212021"}`,
7869
+ userAgent: `okx-a2a-node/${"0.1.2-beta-3bdae0ceae-260701000928"}`,
7867
7870
  auth: {
7868
7871
  ...config.token ? { token: config.token } : {},
7869
7872
  ...config.password ? { password: config.password } : {}
@@ -25082,7 +25085,7 @@ var init_sentry_config = __esm({
25082
25085
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
25083
25086
  SENTRY_CONFIG = {
25084
25087
  projectName: "okx/openclaw-okx-a2a-extension",
25085
- release: "0.1.2-beta-3bdae0ceae-260630212021",
25088
+ release: "0.1.2-beta-3bdae0ceae-260701000928",
25086
25089
  environment
25087
25090
  };
25088
25091
  }
@@ -93065,12 +93068,12 @@ async function runListenerWithLock(options, paths) {
93065
93068
  }));
93066
93069
  }
93067
93070
  });
93068
- service.setPluginVersion("0.1.2-beta-3bdae0ceae-260630212021");
93071
+ service.setPluginVersion("0.1.2-beta-3bdae0ceae-260701000928");
93069
93072
  await service.init();
93070
93073
  const pluginVersionStatus = service.pluginVersionStatus;
93071
93074
  if (pluginVersionStatus.unavailable) {
93072
93075
  throw new Error(
93073
- `@okxweb3/a2a-node v${"0.1.2-beta-3bdae0ceae-260630212021"} is below the required minimum v${pluginVersionStatus.minVersion}`
93076
+ `@okxweb3/a2a-node v${"0.1.2-beta-3bdae0ceae-260701000928"} is below the required minimum v${pluginVersionStatus.minVersion}`
93074
93077
  );
93075
93078
  }
93076
93079
  const systemConfig = service.getSystemConfig();
@@ -93088,7 +93091,7 @@ async function runListenerWithLock(options, paths) {
93088
93091
  onchainosAgentId: "*",
93089
93092
  reason: "system-config missing sentryDsn",
93090
93093
  pluginId: "@okxweb3/a2a-node",
93091
- pluginVersion: "0.1.2-beta-3bdae0ceae-260630212021"
93094
+ pluginVersion: "0.1.2-beta-3bdae0ceae-260701000928"
93092
93095
  });
93093
93096
  }
93094
93097
  logWithTimestamp(
@@ -96197,11 +96200,13 @@ async function runSetup(options) {
96197
96200
  console.log("[setup] okx-a2a node CLI is already up to date; restart skipped");
96198
96201
  }
96199
96202
  const runtime = detectRuntime();
96200
- if (runtime === "codex" || runtime === "claude") {
96201
- switchDefaultProviderForSetup(runtime);
96202
- await ensureAiCliAuthReadyForSetup(runtime, resolvedTarget, releasePlan.resultRelease);
96203
+ const provider = runtime === "codex" || runtime === "claude" ? runtime : configuredNodeAiProviderForSetup();
96204
+ let providerReadiness = null;
96205
+ if (provider) {
96206
+ switchDefaultProviderForSetup(provider);
96207
+ providerReadiness = await ensureAiCliAuthReadyForSetup(provider, resolvedTarget, releasePlan.resultRelease);
96203
96208
  }
96204
- if (nodeChange.nodeChanged && (runtime === "codex" || runtime === "claude")) {
96209
+ if (nodeChange.nodeChanged && provider) {
96205
96210
  await restartNodeDaemonAfterNodeSetup();
96206
96211
  }
96207
96212
  return {
@@ -96209,7 +96214,8 @@ async function runSetup(options) {
96209
96214
  state: "ready",
96210
96215
  target: resolvedTarget,
96211
96216
  release: releasePlan.resultRelease,
96212
- userMessage: "OKX A2A node CLI setup is ready."
96217
+ userMessage: "OKX A2A node CLI setup is ready.",
96218
+ ...providerReadiness
96213
96219
  };
96214
96220
  }
96215
96221
  const changes = await detectSetupChanges(resolvedTarget, releasePlan);
@@ -96278,6 +96284,13 @@ async function runSetup(options) {
96278
96284
  }
96279
96285
  async function detectNodeSetupChange(releasePlan) {
96280
96286
  const nodeVersion = await getCurrentNodeCliVersion();
96287
+ if (!releasePlan.updateNode) {
96288
+ return {
96289
+ nodeVersion,
96290
+ desiredNodeVersion: nodeVersion ?? releasePlan.nodeRelease,
96291
+ nodeChanged: false
96292
+ };
96293
+ }
96281
96294
  const desiredNodeVersion = await resolveRequiredNpmPackageVersion("node", releasePlan.nodeRelease);
96282
96295
  return {
96283
96296
  nodeVersion,
@@ -96317,27 +96330,147 @@ function switchDefaultProviderForSetup(provider) {
96317
96330
  store.close();
96318
96331
  }
96319
96332
  }
96333
+ function configuredNodeAiProviderForSetup() {
96334
+ const provider = readConfiguredAiProvider();
96335
+ return provider === "codex" || provider === "claude" ? provider : null;
96336
+ }
96320
96337
  async function ensureAiCliAuthReadyForSetup(provider, target, release) {
96338
+ if (provider === "codex") {
96339
+ return await ensureCodexCliAuthReadyForSetup(target, release);
96340
+ }
96321
96341
  let command = resolveAiProviderCommand(provider);
96322
- const status = provider === "claude" ? await checkClaudeCliAuthStatus(command) : await checkCodexCliAuthStatus(command);
96342
+ const status = await checkClaudeCliAuthStatus(command);
96323
96343
  if (status.ok) {
96324
96344
  console.log(`[setup] ${provider} CLI auth status is ready`);
96325
- return;
96345
+ return {
96346
+ provider,
96347
+ providerCommand: command,
96348
+ authStatus: "ready"
96349
+ };
96326
96350
  }
96327
96351
  if (status.reason === "provider_cli_missing") {
96328
96352
  await installAiProviderCliForSetup(provider);
96329
96353
  command = resolveAiProviderCommand(provider);
96330
96354
  }
96331
96355
  await runAiProviderLoginForSetup(provider, command, target, release);
96332
- const verified = provider === "claude" ? await checkClaudeCliAuthStatus(command) : await checkCodexCliAuthStatus(command);
96356
+ const verified = await checkClaudeCliAuthStatus(command);
96333
96357
  if (verified.ok) {
96334
96358
  console.log(`[setup] ${provider} CLI auth status is ready after login`);
96335
- return;
96359
+ return {
96360
+ provider,
96361
+ providerCommand: command,
96362
+ authStatus: "ready"
96363
+ };
96364
+ }
96365
+ throw buildAiCliAuthBlockedError(provider, target, release, verified.reason, verified.detail, {
96366
+ provider,
96367
+ providerCommand: command,
96368
+ authStatus: authStatusFromReason(verified.reason)
96369
+ });
96370
+ }
96371
+ async function ensureCodexCliAuthReadyForSetup(target, release) {
96372
+ let cli = await resolveCodexCliForSetup();
96373
+ if (!cli.acceptable && cli.installType === "missing") {
96374
+ await installAiProviderCliForSetup("codex");
96375
+ cli = await resolveCodexCliForSetup();
96376
+ }
96377
+ if (!cli.acceptable) {
96378
+ const reason = cli.installType === "missing" ? "provider_cli_missing" : "provider_cli_unacceptable";
96379
+ throw buildAiCliAuthBlockedError("codex", target, release, reason, cli.reason, metadataFromCodexCli(cli, authStatusFromReason(reason)));
96380
+ }
96381
+ const command = cli.resolvedPath ?? cli.command;
96382
+ const status = await checkCodexCliAuthStatus(command);
96383
+ if (status.ok) {
96384
+ console.log(`[setup] codex CLI auth status is ready (${cli.installType}: ${command})`);
96385
+ return metadataFromCodexCli(cli, "ready");
96386
+ }
96387
+ await runAiProviderLoginForSetup("codex", command, target, release);
96388
+ const verified = await checkCodexCliAuthStatus(command);
96389
+ if (verified.ok) {
96390
+ console.log(`[setup] codex CLI auth status is ready after login (${cli.installType}: ${command})`);
96391
+ return metadataFromCodexCli(cli, "ready");
96392
+ }
96393
+ throw buildAiCliAuthBlockedError("codex", target, release, verified.reason, verified.detail, metadataFromCodexCli(cli, authStatusFromReason(verified.reason)));
96394
+ }
96395
+ async function resolveCodexCliForSetup(env = process.env) {
96396
+ const override = env.OKX_A2A_AI_CODEX_COMMAND;
96397
+ if (override) {
96398
+ const resolvedPath2 = resolveCommandPath(override, env) ?? void 0;
96399
+ return {
96400
+ command: override,
96401
+ resolvedPath: resolvedPath2,
96402
+ installType: "env_override",
96403
+ acceptable: Boolean(resolvedPath2),
96404
+ reason: resolvedPath2 ? void 0 : "OKX_A2A_AI_CODEX_COMMAND is not executable"
96405
+ };
96406
+ }
96407
+ const resolvedPath = resolveCommandPath("codex", env) ?? void 0;
96408
+ if (!resolvedPath) {
96409
+ return {
96410
+ command: "codex",
96411
+ installType: "missing",
96412
+ acceptable: false,
96413
+ reason: "Codex CLI is not installed or not on PATH"
96414
+ };
96415
+ }
96416
+ if (isCodexAppBundledPath(resolvedPath)) {
96417
+ return {
96418
+ command: resolvedPath,
96419
+ resolvedPath,
96420
+ installType: "app_bundled",
96421
+ acceptable: true
96422
+ };
96423
+ }
96424
+ const npmVersion = await getGlobalNpmPackageVersion(CODEX_NPM_PACKAGE);
96425
+ if (npmVersion) {
96426
+ return {
96427
+ command: "codex",
96428
+ resolvedPath,
96429
+ installType: "npm_global",
96430
+ acceptable: true,
96431
+ version: npmVersion
96432
+ };
96433
+ }
96434
+ return {
96435
+ command: "codex",
96436
+ resolvedPath,
96437
+ installType: "path_unknown",
96438
+ acceptable: true
96439
+ };
96440
+ }
96441
+ function isCodexAppBundledPath(commandPath) {
96442
+ return /(?:^|[\\/])Codex\.app[\\/]Contents[\\/]Resources(?:[\\/]|$)/i.test(commandPath);
96443
+ }
96444
+ function metadataFromCodexCli(cli, authStatus) {
96445
+ return {
96446
+ provider: "codex",
96447
+ providerCommand: cli.resolvedPath ?? cli.command,
96448
+ providerCommandPath: cli.resolvedPath,
96449
+ providerInstallType: cli.installType,
96450
+ providerCliAcceptable: cli.acceptable,
96451
+ authStatus
96452
+ };
96453
+ }
96454
+ function authStatusFromReason(reason) {
96455
+ if (reason === "provider_cli_missing") {
96456
+ return "missing";
96457
+ }
96458
+ if (reason === "provider_cli_not_logged_in") {
96459
+ return "not_logged_in";
96460
+ }
96461
+ if (reason === "provider_cli_auth_status_invalid") {
96462
+ return "invalid";
96463
+ }
96464
+ if (reason === "provider_cli_login_failed") {
96465
+ return "login_failed";
96336
96466
  }
96337
- throw buildAiCliAuthBlockedError(provider, target, release, verified.reason, verified.detail);
96467
+ if (reason === "provider_cli_login_timeout") {
96468
+ return "login_timeout";
96469
+ }
96470
+ return "blocked";
96338
96471
  }
96339
96472
  function aiProviderCliInstallSpec(provider) {
96340
- return provider === "claude" ? "@anthropic-ai/claude-code" : "@openai/codex";
96473
+ return provider === "claude" ? "@anthropic-ai/claude-code" : CODEX_NPM_PACKAGE;
96341
96474
  }
96342
96475
  async function installAiProviderCliForSetup(provider) {
96343
96476
  const spec = aiProviderCliInstallSpec(provider);
@@ -96349,20 +96482,34 @@ async function runAiProviderLoginForSetup(provider, command, target, release) {
96349
96482
  const args = provider === "claude" ? ["auth", "login"] : ["login", "--device-auth"];
96350
96483
  console.log(`[setup] running ${provider} CLI login`);
96351
96484
  try {
96352
- await runCommand(command, args, { inheritStdin: true });
96485
+ await runCommand(command, args, {
96486
+ inheritStdin: true,
96487
+ timeoutMs: readAiProviderLoginTimeoutMs()
96488
+ });
96353
96489
  } catch (error) {
96354
96490
  const message = error instanceof Error ? error.message : String(error);
96355
- throw buildAiCliAuthBlockedError(provider, target, release, "provider_cli_login_failed", message);
96491
+ const reason = message.includes("timed out after") ? "provider_cli_login_timeout" : "provider_cli_login_failed";
96492
+ throw buildAiCliAuthBlockedError(provider, target, release, reason, message);
96493
+ }
96494
+ }
96495
+ function readAiProviderLoginTimeoutMs(env = process.env) {
96496
+ const raw = env.OKX_A2A_AI_PROVIDER_LOGIN_TIMEOUT_MS;
96497
+ if (!raw) {
96498
+ return DEFAULT_AI_PROVIDER_LOGIN_TIMEOUT_MS;
96356
96499
  }
96500
+ const parsed = Number(raw);
96501
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_AI_PROVIDER_LOGIN_TIMEOUT_MS;
96357
96502
  }
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";
96503
+ function buildAiCliAuthBlockedError(provider, target, release, reason, detail, metadata) {
96504
+ const installCommand = provider === "claude" ? "npm install -g @anthropic-ai/claude-code" : `npm install -g ${CODEX_NPM_PACKAGE}`;
96360
96505
  const nextCommand = provider === "claude" ? "claude auth login" : "codex login --device-auth";
96361
96506
  const verifyCommand = provider === "claude" ? "claude auth status --json" : "codex login status";
96362
96507
  const providerLabel = provider === "claude" ? "Claude Code" : "Codex";
96363
96508
  const missing = reason === "provider_cli_missing";
96509
+ const unacceptable = reason === "provider_cli_unacceptable";
96364
96510
  const loginFailed = reason === "provider_cli_login_failed";
96365
- const commandText = missing ? `${installCommand} && ${nextCommand}` : nextCommand;
96511
+ const loginTimedOut = reason === "provider_cli_login_timeout";
96512
+ const commandText = missing || unacceptable ? `${installCommand} && ${nextCommand}` : nextCommand;
96366
96513
  const detailText = detail ? `
96367
96514
 
96368
96515
  Detail:
@@ -96373,11 +96520,17 @@ ${detail}` : "";
96373
96520
  target,
96374
96521
  release,
96375
96522
  reason,
96376
- installCommand: missing ? installCommand : void 0,
96523
+ installCommand: missing || unacceptable ? installCommand : void 0,
96377
96524
  nextCommand,
96378
96525
  verifyCommand,
96526
+ provider,
96527
+ authStatus: metadata?.authStatus ?? authStatusFromReason(reason),
96528
+ providerCommand: metadata?.providerCommand,
96529
+ providerCommandPath: metadata?.providerCommandPath,
96530
+ providerInstallType: metadata?.providerInstallType,
96531
+ providerCliAcceptable: metadata?.providerCliAcceptable,
96379
96532
  userMessage: [
96380
- `${providerLabel} CLI ${loginFailed ? "login did not complete" : `is ${missing ? "not installed or not on PATH" : "not logged in"}`}.`,
96533
+ `${providerLabel} CLI ${loginFailed || loginTimedOut ? "login did not complete" : unacceptable ? "is not an acceptable standalone CLI" : `is ${missing ? "not installed or not on PATH" : "not logged in"}`}.`,
96381
96534
  "Your GUI session may be active, but OKX A2A uses the local CLI credential store.",
96382
96535
  `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
96536
  `Then rerun: okx-a2a setup --json`
@@ -96429,6 +96582,9 @@ function detectSetupTarget() {
96429
96582
  return "node";
96430
96583
  }
96431
96584
  const configured = readConfiguredAiProvider();
96585
+ if (configured === "codex" || configured === "claude") {
96586
+ return "node";
96587
+ }
96432
96588
  if (configured === "openclaw" || configured === "hermes") {
96433
96589
  return configured;
96434
96590
  }
@@ -96445,12 +96601,20 @@ function warnIfProviderMismatch(target) {
96445
96601
  }
96446
96602
  async function resolveSetupRelease(target, options) {
96447
96603
  const { release: requestedRelease, releaseExplicit } = options;
96604
+ let nodeRelease = requestedRelease;
96605
+ let updateNode2 = !releaseExplicit || requestedRelease === "latest";
96606
+ const currentNodeVersion = await getCurrentNodeCliVersion();
96607
+ if (currentNodeVersion && isPrereleaseVersion(currentNodeVersion)) {
96608
+ console.log(`[setup] preserving current beta okx-a2a node CLI version ${currentNodeVersion}; use okx-a2a update --release beta --restart --yes to update beta node`);
96609
+ nodeRelease = currentNodeVersion;
96610
+ updateNode2 = false;
96611
+ }
96448
96612
  if (target === "node") {
96449
96613
  return {
96450
- nodeRelease: requestedRelease,
96614
+ nodeRelease,
96451
96615
  gatewayRelease: requestedRelease,
96452
- resultRelease: requestedRelease,
96453
- updateNode: true
96616
+ resultRelease: nodeRelease,
96617
+ updateNode: updateNode2
96454
96618
  };
96455
96619
  }
96456
96620
  let gatewayRelease = requestedRelease;
@@ -96459,14 +96623,6 @@ async function resolveSetupRelease(target, options) {
96459
96623
  console.log(`[setup] preserving installed beta gateway plugin version ${installedVersion}; pass --release latest to upgrade`);
96460
96624
  gatewayRelease = installedVersion;
96461
96625
  }
96462
- let nodeRelease = requestedRelease;
96463
- let updateNode2 = !releaseExplicit || requestedRelease === "latest";
96464
- const currentNodeVersion = await getCurrentNodeCliVersion();
96465
- if (currentNodeVersion && isPrereleaseVersion(currentNodeVersion)) {
96466
- console.log(`[setup] preserving current beta okx-a2a node CLI version ${currentNodeVersion}; use okx-a2a update --release beta --restart --yes to update beta node`);
96467
- nodeRelease = currentNodeVersion;
96468
- updateNode2 = false;
96469
- }
96470
96626
  return {
96471
96627
  nodeRelease,
96472
96628
  gatewayRelease,
@@ -96481,10 +96637,10 @@ async function getCurrentNodeCliVersion() {
96481
96637
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
96482
96638
  }
96483
96639
  function getBundledNodeCliVersion() {
96484
- return true ? "0.1.2-beta-3bdae0ceae-260630212021" : null;
96640
+ return true ? "0.1.2-beta-3bdae0ceae-260701000928" : null;
96485
96641
  }
96486
96642
  function readConfiguredAiProvider() {
96487
- const explicit = process.env.OKX_AGENT_TASK_AI_CLI ?? process.env.OKX_A2A_AI_PROVIDER;
96643
+ const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
96488
96644
  if (explicit) {
96489
96645
  try {
96490
96646
  return normalizeAiProvider(explicit);
@@ -97217,17 +97373,39 @@ async function runCommand(command, args, options = {}) {
97217
97373
  cwd: options.cwd,
97218
97374
  stdio: redirectCommandStdoutToStderr ? [options.inheritStdin ? "inherit" : "ignore", "pipe", "pipe"] : "inherit"
97219
97375
  });
97376
+ let settled = false;
97377
+ let timeout = null;
97378
+ const finish = (callback) => {
97379
+ if (settled) {
97380
+ return;
97381
+ }
97382
+ settled = true;
97383
+ if (timeout) {
97384
+ clearTimeout(timeout);
97385
+ }
97386
+ callback();
97387
+ };
97388
+ if (options.timeoutMs) {
97389
+ timeout = setTimeout(() => {
97390
+ finish(() => {
97391
+ child.kill("SIGTERM");
97392
+ reject(new Error(`${command} ${args.join(" ")} timed out after ${options.timeoutMs}ms`));
97393
+ });
97394
+ }, options.timeoutMs);
97395
+ }
97220
97396
  if (redirectCommandStdoutToStderr && child.stdout && child.stderr) {
97221
97397
  child.stdout.pipe(process.stderr);
97222
97398
  child.stderr.pipe(process.stderr);
97223
97399
  }
97224
- child.on("error", reject);
97400
+ child.on("error", (error) => {
97401
+ finish(() => reject(error));
97402
+ });
97225
97403
  child.on("close", (code2, signal) => {
97226
97404
  if (code2 === 0) {
97227
- resolvePromise();
97405
+ finish(() => resolvePromise());
97228
97406
  return;
97229
97407
  }
97230
- reject(new Error(`${command} ${args.join(" ")} failed with ${signal ? `signal=${signal}` : `code=${code2}`}`));
97408
+ finish(() => reject(new Error(`${command} ${args.join(" ")} failed with ${signal ? `signal=${signal}` : `code=${code2}`}`)));
97231
97409
  });
97232
97410
  });
97233
97411
  }
@@ -97309,7 +97487,7 @@ async function runCommandCaptureStatus(command, args) {
97309
97487
  });
97310
97488
  });
97311
97489
  }
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;
97490
+ var import_node_child_process8, import_node_fs18, import_promises8, import_node_os9, import_node_path22, UPDATE_PACKAGES, CODEX_NPM_PACKAGE, 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, DEFAULT_AI_PROVIDER_LOGIN_TIMEOUT_MS, SetupBlockedError, redirectCommandStdoutToStderr;
97313
97491
  var init_update_cli = __esm({
97314
97492
  "src/update-cli.ts"() {
97315
97493
  "use strict";
@@ -97326,6 +97504,7 @@ var init_update_cli = __esm({
97326
97504
  openclaw: "@okxweb3/a2a-openclaw",
97327
97505
  hermes: "@okxweb3/a2a-hermes"
97328
97506
  };
97507
+ CODEX_NPM_PACKAGE = "@openai/codex";
97329
97508
  OPENCLAW_FORCE_INSTALL_FLAG = "--force";
97330
97509
  OPENCLAW_UNSAFE_INSTALL_FLAG = "--dangerously-force-unsafe-install";
97331
97510
  OKX_A2A_PLUGIN_ID = "okx-a2a";
@@ -97333,6 +97512,7 @@ var init_update_cli = __esm({
97333
97512
  OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE = "per-channel-peer";
97334
97513
  OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH = "plugins.allow";
97335
97514
  OPENCLAW_OKX_A2A_CONVERSATION_HOOK_ACCESS_CONFIG_PATH = "plugins.entries.okx-a2a.hooks.allowConversationAccess";
97515
+ DEFAULT_AI_PROVIDER_LOGIN_TIMEOUT_MS = 3 * 60 * 1e3;
97336
97516
  SetupBlockedError = class extends Error {
97337
97517
  result;
97338
97518
  constructor(result) {
@@ -97363,7 +97543,7 @@ init_sentry_logger();
97363
97543
  init_sentry_config();
97364
97544
  var CURRENT_GATEWAY_SESSION_KEYS_ENV3 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
97365
97545
  function printUsage2() {
97366
- console.log(`okx-a2a ${"0.1.2-beta-3bdae0ceae-260630212021"}
97546
+ console.log(`okx-a2a ${"0.1.2-beta-3bdae0ceae-260701000928"}
97367
97547
 
97368
97548
  Usage:
97369
97549
  okx-a2a <command> [options]
@@ -97400,7 +97580,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
97400
97580
  `);
97401
97581
  }
97402
97582
  function printVersion() {
97403
- console.log("0.1.2-beta-3bdae0ceae-260630212021");
97583
+ console.log("0.1.2-beta-3bdae0ceae-260701000928");
97404
97584
  }
97405
97585
  function printDaemonUsage() {
97406
97586
  console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
package/dist/index.js CHANGED
@@ -70160,7 +70160,10 @@ function resolveAiProviderCommand(provider, env = process.env) {
70160
70160
  if (override) {
70161
70161
  return override;
70162
70162
  }
70163
- return findExecutable(provider, env) ?? provider;
70163
+ return resolveCommandPath(provider, env) ?? provider;
70164
+ }
70165
+ function resolveCommandPath(command, env = process.env) {
70166
+ return findExecutable(command, env);
70164
70167
  }
70165
70168
  function commandExists(command, env = process.env) {
70166
70169
  if (isExecutable(command)) {
@@ -86724,7 +86727,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
86724
86727
  client: {
86725
86728
  id: "gateway-client",
86726
86729
  displayName: "okx-a2a-node",
86727
- version: "0.1.2-beta-3bdae0ceae-260630212021",
86730
+ version: "0.1.2-beta-3bdae0ceae-260701000928",
86728
86731
  platform: "node",
86729
86732
  mode: "backend",
86730
86733
  instanceId
@@ -86735,7 +86738,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
86735
86738
  commands: [],
86736
86739
  permissions: {},
86737
86740
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
86738
- userAgent: `okx-a2a-node/${"0.1.2-beta-3bdae0ceae-260630212021"}`,
86741
+ userAgent: `okx-a2a-node/${"0.1.2-beta-3bdae0ceae-260701000928"}`,
86739
86742
  auth: {
86740
86743
  ...config.token ? { token: config.token } : {},
86741
86744
  ...config.password ? { password: config.password } : {}
@@ -91154,7 +91157,7 @@ function userWatchEventDeliveredSentryExtra(event) {
91154
91157
  var environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
91155
91158
  var SENTRY_CONFIG = {
91156
91159
  projectName: "okx/openclaw-okx-a2a-extension",
91157
- release: "0.1.2-beta-3bdae0ceae-260630212021",
91160
+ release: "0.1.2-beta-3bdae0ceae-260701000928",
91158
91161
  environment
91159
91162
  };
91160
91163
 
@@ -91381,12 +91384,12 @@ async function runListenerWithLock(options, paths) {
91381
91384
  }));
91382
91385
  }
91383
91386
  });
91384
- service.setPluginVersion("0.1.2-beta-3bdae0ceae-260630212021");
91387
+ service.setPluginVersion("0.1.2-beta-3bdae0ceae-260701000928");
91385
91388
  await service.init();
91386
91389
  const pluginVersionStatus = service.pluginVersionStatus;
91387
91390
  if (pluginVersionStatus.unavailable) {
91388
91391
  throw new Error(
91389
- `@okxweb3/a2a-node v${"0.1.2-beta-3bdae0ceae-260630212021"} is below the required minimum v${pluginVersionStatus.minVersion}`
91392
+ `@okxweb3/a2a-node v${"0.1.2-beta-3bdae0ceae-260701000928"} is below the required minimum v${pluginVersionStatus.minVersion}`
91390
91393
  );
91391
91394
  }
91392
91395
  const systemConfig = service.getSystemConfig();
@@ -91404,7 +91407,7 @@ async function runListenerWithLock(options, paths) {
91404
91407
  onchainosAgentId: "*",
91405
91408
  reason: "system-config missing sentryDsn",
91406
91409
  pluginId: "@okxweb3/a2a-node",
91407
- pluginVersion: "0.1.2-beta-3bdae0ceae-260630212021"
91410
+ pluginVersion: "0.1.2-beta-3bdae0ceae-260701000928"
91408
91411
  });
91409
91412
  }
91410
91413
  logWithTimestamp(
@@ -91744,6 +91747,7 @@ var OPENCLAW_SESSION_DM_SCOPE_CONFIG_PATH = "session.dmScope";
91744
91747
  var OPENCLAW_SESSION_DM_SCOPE_CONFIG_VALUE = "per-channel-peer";
91745
91748
  var OPENCLAW_PLUGIN_ALLOW_CONFIG_PATH = "plugins.allow";
91746
91749
  var OPENCLAW_OKX_A2A_CONVERSATION_HOOK_ACCESS_CONFIG_PATH = "plugins.entries.okx-a2a.hooks.allowConversationAccess";
91750
+ var DEFAULT_AI_PROVIDER_LOGIN_TIMEOUT_MS = 3 * 60 * 1e3;
91747
91751
  var redirectCommandStdoutToStderr = false;
91748
91752
  function isPrereleaseVersion(version2) {
91749
91753
  return /\d+\.\d+\.\d+-[0-9A-Za-z.-]+/.test(version2);
@@ -92065,17 +92069,39 @@ async function runCommand(command, args, options = {}) {
92065
92069
  cwd: options.cwd,
92066
92070
  stdio: redirectCommandStdoutToStderr ? [options.inheritStdin ? "inherit" : "ignore", "pipe", "pipe"] : "inherit"
92067
92071
  });
92072
+ let settled = false;
92073
+ let timeout = null;
92074
+ const finish = (callback) => {
92075
+ if (settled) {
92076
+ return;
92077
+ }
92078
+ settled = true;
92079
+ if (timeout) {
92080
+ clearTimeout(timeout);
92081
+ }
92082
+ callback();
92083
+ };
92084
+ if (options.timeoutMs) {
92085
+ timeout = setTimeout(() => {
92086
+ finish(() => {
92087
+ child.kill("SIGTERM");
92088
+ reject(new Error(`${command} ${args.join(" ")} timed out after ${options.timeoutMs}ms`));
92089
+ });
92090
+ }, options.timeoutMs);
92091
+ }
92068
92092
  if (redirectCommandStdoutToStderr && child.stdout && child.stderr) {
92069
92093
  child.stdout.pipe(process.stderr);
92070
92094
  child.stderr.pipe(process.stderr);
92071
92095
  }
92072
- child.on("error", reject);
92096
+ child.on("error", (error) => {
92097
+ finish(() => reject(error));
92098
+ });
92073
92099
  child.on("close", (code2, signal) => {
92074
92100
  if (code2 === 0) {
92075
- resolvePromise();
92101
+ finish(() => resolvePromise());
92076
92102
  return;
92077
92103
  }
92078
- reject(new Error(`${command} ${args.join(" ")} failed with ${signal ? `signal=${signal}` : `code=${code2}`}`));
92104
+ finish(() => reject(new Error(`${command} ${args.join(" ")} failed with ${signal ? `signal=${signal}` : `code=${code2}`}`)));
92079
92105
  });
92080
92106
  });
92081
92107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okxweb3/a2a-node",
3
- "version": "0.1.2-beta-3bdae0ceae-260630212021",
3
+ "version": "0.1.2-beta-3bdae0ceae-260701000928",
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": {