@okxweb3/a2a-node 0.2.16-beta-ca2f5282c7-260921143311 → 0.2.16

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 +77 -14
  2. package/dist/index.js +74 -11
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -26821,7 +26821,7 @@ async function callOpenClawGateway(opts) {
26821
26821
  if (isRetryableOpenClawGatewayError(err2)) {
26822
26822
  clearClient();
26823
26823
  }
26824
- if (isGatewayStartingError(err2) && delayMs !== void 0 && Date.now() + delayMs - startedAt < timeoutMs) {
26824
+ if (opts.retryOnStarting !== false && isGatewayStartingError(err2) && delayMs !== void 0 && Date.now() + delayMs - startedAt < timeoutMs) {
26825
26825
  errorWithTimestamp(
26826
26826
  `${LOG_PREFIX2} rpc retry method=${opts.method} attempt=${attempt + 1} delayMs=${delayMs}: ${message}`
26827
26827
  );
@@ -26870,6 +26870,9 @@ async function callSessionsSend(params) {
26870
26870
  try {
26871
26871
  return await callOpenClawGateway({ method: "sessions.send", params: sendParams });
26872
26872
  } catch (err2) {
26873
+ if (params.restoreArchived === true && isArchivedSessionSendError(err2, params.key)) {
26874
+ return restoreArchivedSessionAndSendOnce(params.key, sendParams);
26875
+ }
26873
26876
  if (isSessionNotFound(err2)) {
26874
26877
  await callSessionsCreate({ key: params.key });
26875
26878
  return callOpenClawGateway({ method: "sessions.send", params: sendParams });
@@ -26877,6 +26880,62 @@ async function callSessionsSend(params) {
26877
26880
  throw err2;
26878
26881
  }
26879
26882
  }
26883
+ function isArchivedSessionSendError(error, key) {
26884
+ const e = error;
26885
+ return (e?.gatewayCode ?? e?.code) === "INVALID_REQUEST" && String(e?.message) === `Session "${key}" is archived. Restore it before starting new work.`;
26886
+ }
26887
+ async function restoreArchivedSessionAndSendOnce(key, sendParams) {
26888
+ let stage = "lookup";
26889
+ try {
26890
+ let entry;
26891
+ let offset = 0;
26892
+ for (let page = 0; page < 10; page += 1) {
26893
+ const raw = await callOpenClawGateway({
26894
+ method: "sessions.list",
26895
+ params: { search: key, archived: "all", limit: 200, offset },
26896
+ retryOnStarting: false
26897
+ });
26898
+ const listPage = raw;
26899
+ if (!listPage || !Array.isArray(listPage.sessions)) {
26900
+ throw new Error("Invalid sessions.list response");
26901
+ }
26902
+ entry = listPage.sessions.find((row) => row?.key === key);
26903
+ if (entry || listPage.hasMore !== true) {
26904
+ break;
26905
+ }
26906
+ if (!(Number.isInteger(listPage.nextOffset) && listPage.nextOffset > offset)) {
26907
+ throw new Error("Invalid sessions.list pagination");
26908
+ }
26909
+ offset = listPage.nextOffset;
26910
+ }
26911
+ if (!entry || typeof entry.sessionId !== "string" || !entry.sessionId) {
26912
+ throw new Error("Exact session identity unavailable for archive recovery");
26913
+ }
26914
+ stage = "restore";
26915
+ if (entry.archivedAt !== void 0) {
26916
+ await callOpenClawGateway({
26917
+ method: "sessions.patch",
26918
+ params: {
26919
+ key,
26920
+ archived: false,
26921
+ expectedSessionId: entry.sessionId,
26922
+ ...typeof entry.lifecycleRevision === "string" && entry.lifecycleRevision ? { expectedLifecycleRevision: entry.lifecycleRevision } : {}
26923
+ },
26924
+ retryOnStarting: false
26925
+ });
26926
+ }
26927
+ stage = "resend";
26928
+ return await callOpenClawGateway({ method: "sessions.send", params: sendParams, retryOnStarting: false });
26929
+ } catch (cause) {
26930
+ throw Object.assign(
26931
+ new Error(
26932
+ `Archived job session recovery failed at ${stage}: ${cause instanceof Error ? cause.message : String(cause)}`,
26933
+ { cause }
26934
+ ),
26935
+ { code: "A2A_ARCHIVE_RECOVERY_FAILED", retryable: false, recoveryStage: stage }
26936
+ );
26937
+ }
26938
+ }
26880
26939
  async function callChatInject(params) {
26881
26940
  try {
26882
26941
  return await callOpenClawGateway({ method: "chat.inject", params });
@@ -26896,6 +26955,9 @@ async function callPromptUserToLatestSessions(params) {
26896
26955
  }
26897
26956
  function isRetryableOpenClawGatewayError(err2) {
26898
26957
  const e = err2;
26958
+ if (e?.code === "A2A_ARCHIVE_RECOVERY_FAILED") {
26959
+ return false;
26960
+ }
26899
26961
  if (e?.retryable || e?.details?.retryable) {
26900
26962
  return true;
26901
26963
  }
@@ -26939,7 +27001,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
26939
27001
  client: {
26940
27002
  id: "gateway-client",
26941
27003
  displayName: "okx-a2a-node",
26942
- version: "0.2.16-beta-ca2f5282c7-260921143311",
27004
+ version: "0.2.16",
26943
27005
  platform: "node",
26944
27006
  mode: "backend",
26945
27007
  instanceId
@@ -26950,7 +27012,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
26950
27012
  commands: [],
26951
27013
  permissions: {},
26952
27014
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
26953
- userAgent: `okx-a2a-node/${"0.2.16-beta-ca2f5282c7-260921143311"}`,
27015
+ userAgent: `okx-a2a-node/${"0.2.16"}`,
26954
27016
  auth: {
26955
27017
  ...config.token ? { token: config.token } : {},
26956
27018
  ...config.password ? { password: config.password } : {}
@@ -27989,6 +28051,7 @@ var init_outbound_behavior = __esm({
27989
28051
  const sendResult = await this.gateway.callSessionsSend({
27990
28052
  key: gatewaySessionKey,
27991
28053
  message: input.content,
28054
+ restoreArchived: true,
27992
28055
  ...input.messageId ? { idempotencyKey: input.messageId } : {}
27993
28056
  });
27994
28057
  errorWithTimestamp(
@@ -29009,7 +29072,7 @@ var init_sentry_config = __esm({
29009
29072
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
29010
29073
  SENTRY_CONFIG = {
29011
29074
  projectName: "okx/openclaw-okx-a2a-extension",
29012
- release: "0.2.16-beta-ca2f5282c7-260921143311",
29075
+ release: "0.2.16",
29013
29076
  environment,
29014
29077
  runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
29015
29078
  };
@@ -40179,7 +40242,7 @@ async function exportDiagnosticLogs(options) {
40179
40242
  node: process.version,
40180
40243
  platform: process.platform,
40181
40244
  arch: process.arch,
40182
- packageVersion: true ? "0.2.16-beta-ca2f5282c7-260921143311" : "unknown",
40245
+ packageVersion: true ? "0.2.16" : "unknown",
40183
40246
  sensitiveContentIncluded: options.includeSensitiveContent,
40184
40247
  listenerAndLlmContentIncluded: true,
40185
40248
  credentialsAlwaysRedacted: true,
@@ -69685,12 +69748,12 @@ async function runListenerWithLock(options, paths) {
69685
69748
  });
69686
69749
  }
69687
69750
  });
69688
- service.setPluginVersion("0.2.16-beta-ca2f5282c7-260921143311");
69751
+ service.setPluginVersion("0.2.16");
69689
69752
  await service.init();
69690
69753
  const pluginVersionStatus = service.pluginVersionStatus;
69691
69754
  if (pluginVersionStatus.unavailable) {
69692
69755
  throw new Error(
69693
- `@okxweb3/a2a-node v${"0.2.16-beta-ca2f5282c7-260921143311"} is below the required minimum v${pluginVersionStatus.minVersion}`
69756
+ `@okxweb3/a2a-node v${"0.2.16"} is below the required minimum v${pluginVersionStatus.minVersion}`
69694
69757
  );
69695
69758
  }
69696
69759
  const systemConfig = service.getSystemConfig();
@@ -69718,7 +69781,7 @@ async function runListenerWithLock(options, paths) {
69718
69781
  onchainosAgentId: "*",
69719
69782
  reason: "system-config missing sentryDsn",
69720
69783
  pluginId: "@okxweb3/a2a-node",
69721
- pluginVersion: "0.2.16-beta-ca2f5282c7-260921143311"
69784
+ pluginVersion: "0.2.16"
69722
69785
  });
69723
69786
  }
69724
69787
  logWithTimestamp(
@@ -118060,7 +118123,7 @@ async function getCurrentNodeCliVersion() {
118060
118123
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
118061
118124
  }
118062
118125
  function getBundledNodeCliVersion() {
118063
- return true ? "0.2.16-beta-ca2f5282c7-260921143311" : null;
118126
+ return true ? "0.2.16" : null;
118064
118127
  }
118065
118128
  function readConfiguredAiProvider() {
118066
118129
  const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
@@ -118270,7 +118333,7 @@ async function updateHermes(release, options) {
118270
118333
  }
118271
118334
  }
118272
118335
  async function installGatewayPluginForDoctor(target) {
118273
- const release = isPrereleaseVersion("0.2.16-beta-ca2f5282c7-260921143311") ? "beta" : "latest";
118336
+ const release = isPrereleaseVersion("0.2.16") ? "beta" : "latest";
118274
118337
  const insideTargetGateway = detectGatewayInvocation() === target;
118275
118338
  const options = {
118276
118339
  restart: !insideTargetGateway,
@@ -119323,7 +119386,7 @@ async function runDoctor(options = {}) {
119323
119386
  platform: options.platform ?? process.platform,
119324
119387
  env: options.env ?? process.env,
119325
119388
  target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
119326
- cliVersion: options.cliVersion ?? (true ? "0.2.16-beta-ca2f5282c7-260921143311" : "0.0.0"),
119389
+ cliVersion: options.cliVersion ?? (true ? "0.2.16" : "0.0.0"),
119327
119390
  fixMode: options.fix === true,
119328
119391
  nonInteractive: options.nonInteractive === true,
119329
119392
  packageChanged: false,
@@ -120430,7 +120493,7 @@ init_sentry_config();
120430
120493
  init_runtime_metadata();
120431
120494
  var CURRENT_GATEWAY_SESSION_KEYS_ENV4 = "OKX_A2A_CURRENT_GATEWAY_SESSION_KEYS";
120432
120495
  function printUsage3() {
120433
- console.log(`okx-a2a ${"0.2.16-beta-ca2f5282c7-260921143311"}
120496
+ console.log(`okx-a2a ${"0.2.16"}
120434
120497
 
120435
120498
  Usage:
120436
120499
  okx-a2a <command> [options]
@@ -120472,7 +120535,7 @@ Run \`okx-a2a <command> -h\` for command-specific help.
120472
120535
  `);
120473
120536
  }
120474
120537
  function printVersion() {
120475
- console.log("0.2.16-beta-ca2f5282c7-260921143311");
120538
+ console.log("0.2.16");
120476
120539
  }
120477
120540
  function printDaemonUsage() {
120478
120541
  console.log(`Usage: okx-a2a daemon <start|restart|stop|status|autostart> [options]
@@ -121967,7 +122030,7 @@ async function main() {
121967
122030
  if (command === "xmtp-test") {
121968
122031
  const { handleXmtpTestCommand: handleXmtpTestCommand2 } = await Promise.resolve().then(() => (init_xmtp_test_cli(), xmtp_test_cli_exports));
121969
122032
  await handleXmtpTestCommand2(process.argv.slice(3), {
121970
- packageVersion: "0.2.16-beta-ca2f5282c7-260921143311",
122033
+ packageVersion: "0.2.16",
121971
122034
  agentSdkVersion: "2.3.0",
121972
122035
  nodeSdkVersion: "6.1.0",
121973
122036
  nodeBindingsVersion: "1.11.0"
package/dist/index.js CHANGED
@@ -32448,7 +32448,7 @@ var init_sentry_config = __esm({
32448
32448
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
32449
32449
  SENTRY_CONFIG = {
32450
32450
  projectName: "okx/openclaw-okx-a2a-extension",
32451
- release: "0.2.16-beta-ca2f5282c7-260921143311",
32451
+ release: "0.2.16",
32452
32452
  environment,
32453
32453
  runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
32454
32454
  };
@@ -33404,7 +33404,7 @@ async function getCurrentNodeCliVersion() {
33404
33404
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
33405
33405
  }
33406
33406
  function getBundledNodeCliVersion() {
33407
- return true ? "0.2.16-beta-ca2f5282c7-260921143311" : null;
33407
+ return true ? "0.2.16" : null;
33408
33408
  }
33409
33409
  function readConfiguredAiProvider() {
33410
33410
  const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
@@ -33614,7 +33614,7 @@ async function updateHermes(release, options) {
33614
33614
  }
33615
33615
  }
33616
33616
  async function installGatewayPluginForDoctor(target) {
33617
- const release = isPrereleaseVersion("0.2.16-beta-ca2f5282c7-260921143311") ? "beta" : "latest";
33617
+ const release = isPrereleaseVersion("0.2.16") ? "beta" : "latest";
33618
33618
  const insideTargetGateway = detectGatewayInvocation() === target;
33619
33619
  const options = {
33620
33620
  restart: !insideTargetGateway,
@@ -61016,7 +61016,7 @@ async function callOpenClawGateway(opts) {
61016
61016
  if (isRetryableOpenClawGatewayError(err)) {
61017
61017
  clearClient();
61018
61018
  }
61019
- if (isGatewayStartingError(err) && delayMs !== void 0 && Date.now() + delayMs - startedAt < timeoutMs) {
61019
+ if (opts.retryOnStarting !== false && isGatewayStartingError(err) && delayMs !== void 0 && Date.now() + delayMs - startedAt < timeoutMs) {
61020
61020
  errorWithTimestamp(
61021
61021
  `${LOG_PREFIX2} rpc retry method=${opts.method} attempt=${attempt + 1} delayMs=${delayMs}: ${message}`
61022
61022
  );
@@ -61069,6 +61069,9 @@ async function callSessionsSend(params) {
61069
61069
  try {
61070
61070
  return await callOpenClawGateway({ method: "sessions.send", params: sendParams });
61071
61071
  } catch (err) {
61072
+ if (params.restoreArchived === true && isArchivedSessionSendError(err, params.key)) {
61073
+ return restoreArchivedSessionAndSendOnce(params.key, sendParams);
61074
+ }
61072
61075
  if (isSessionNotFound(err)) {
61073
61076
  await callSessionsCreate({ key: params.key });
61074
61077
  return callOpenClawGateway({ method: "sessions.send", params: sendParams });
@@ -61076,6 +61079,62 @@ async function callSessionsSend(params) {
61076
61079
  throw err;
61077
61080
  }
61078
61081
  }
61082
+ function isArchivedSessionSendError(error, key) {
61083
+ const e = error;
61084
+ return (e?.gatewayCode ?? e?.code) === "INVALID_REQUEST" && String(e?.message) === `Session "${key}" is archived. Restore it before starting new work.`;
61085
+ }
61086
+ async function restoreArchivedSessionAndSendOnce(key, sendParams) {
61087
+ let stage = "lookup";
61088
+ try {
61089
+ let entry;
61090
+ let offset = 0;
61091
+ for (let page = 0; page < 10; page += 1) {
61092
+ const raw = await callOpenClawGateway({
61093
+ method: "sessions.list",
61094
+ params: { search: key, archived: "all", limit: 200, offset },
61095
+ retryOnStarting: false
61096
+ });
61097
+ const listPage = raw;
61098
+ if (!listPage || !Array.isArray(listPage.sessions)) {
61099
+ throw new Error("Invalid sessions.list response");
61100
+ }
61101
+ entry = listPage.sessions.find((row) => row?.key === key);
61102
+ if (entry || listPage.hasMore !== true) {
61103
+ break;
61104
+ }
61105
+ if (!(Number.isInteger(listPage.nextOffset) && listPage.nextOffset > offset)) {
61106
+ throw new Error("Invalid sessions.list pagination");
61107
+ }
61108
+ offset = listPage.nextOffset;
61109
+ }
61110
+ if (!entry || typeof entry.sessionId !== "string" || !entry.sessionId) {
61111
+ throw new Error("Exact session identity unavailable for archive recovery");
61112
+ }
61113
+ stage = "restore";
61114
+ if (entry.archivedAt !== void 0) {
61115
+ await callOpenClawGateway({
61116
+ method: "sessions.patch",
61117
+ params: {
61118
+ key,
61119
+ archived: false,
61120
+ expectedSessionId: entry.sessionId,
61121
+ ...typeof entry.lifecycleRevision === "string" && entry.lifecycleRevision ? { expectedLifecycleRevision: entry.lifecycleRevision } : {}
61122
+ },
61123
+ retryOnStarting: false
61124
+ });
61125
+ }
61126
+ stage = "resend";
61127
+ return await callOpenClawGateway({ method: "sessions.send", params: sendParams, retryOnStarting: false });
61128
+ } catch (cause) {
61129
+ throw Object.assign(
61130
+ new Error(
61131
+ `Archived job session recovery failed at ${stage}: ${cause instanceof Error ? cause.message : String(cause)}`,
61132
+ { cause }
61133
+ ),
61134
+ { code: "A2A_ARCHIVE_RECOVERY_FAILED", retryable: false, recoveryStage: stage }
61135
+ );
61136
+ }
61137
+ }
61079
61138
  async function callChatInject(params) {
61080
61139
  try {
61081
61140
  return await callOpenClawGateway({ method: "chat.inject", params });
@@ -61095,6 +61154,9 @@ async function callPromptUserToLatestSessions(params) {
61095
61154
  }
61096
61155
  function isRetryableOpenClawGatewayError(err) {
61097
61156
  const e = err;
61157
+ if (e?.code === "A2A_ARCHIVE_RECOVERY_FAILED") {
61158
+ return false;
61159
+ }
61098
61160
  if (e?.retryable || e?.details?.retryable) {
61099
61161
  return true;
61100
61162
  }
@@ -61332,7 +61394,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
61332
61394
  client: {
61333
61395
  id: "gateway-client",
61334
61396
  displayName: "okx-a2a-node",
61335
- version: "0.2.16-beta-ca2f5282c7-260921143311",
61397
+ version: "0.2.16",
61336
61398
  platform: "node",
61337
61399
  mode: "backend",
61338
61400
  instanceId
@@ -61343,7 +61405,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
61343
61405
  commands: [],
61344
61406
  permissions: {},
61345
61407
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
61346
- userAgent: `okx-a2a-node/${"0.2.16-beta-ca2f5282c7-260921143311"}`,
61408
+ userAgent: `okx-a2a-node/${"0.2.16"}`,
61347
61409
  auth: {
61348
61410
  ...config.token ? { token: config.token } : {},
61349
61411
  ...config.password ? { password: config.password } : {}
@@ -62134,6 +62196,7 @@ var GatewayOutboundBehavior = class {
62134
62196
  const sendResult = await this.gateway.callSessionsSend({
62135
62197
  key: gatewaySessionKey,
62136
62198
  message: input.content,
62199
+ restoreArchived: true,
62137
62200
  ...input.messageId ? { idempotencyKey: input.messageId } : {}
62138
62201
  });
62139
62202
  errorWithTimestamp(
@@ -67682,12 +67745,12 @@ async function runListenerWithLock(options, paths) {
67682
67745
  });
67683
67746
  }
67684
67747
  });
67685
- service.setPluginVersion("0.2.16-beta-ca2f5282c7-260921143311");
67748
+ service.setPluginVersion("0.2.16");
67686
67749
  await service.init();
67687
67750
  const pluginVersionStatus = service.pluginVersionStatus;
67688
67751
  if (pluginVersionStatus.unavailable) {
67689
67752
  throw new Error(
67690
- `@okxweb3/a2a-node v${"0.2.16-beta-ca2f5282c7-260921143311"} is below the required minimum v${pluginVersionStatus.minVersion}`
67753
+ `@okxweb3/a2a-node v${"0.2.16"} is below the required minimum v${pluginVersionStatus.minVersion}`
67691
67754
  );
67692
67755
  }
67693
67756
  const systemConfig = service.getSystemConfig();
@@ -67715,7 +67778,7 @@ async function runListenerWithLock(options, paths) {
67715
67778
  onchainosAgentId: "*",
67716
67779
  reason: "system-config missing sentryDsn",
67717
67780
  pluginId: "@okxweb3/a2a-node",
67718
- pluginVersion: "0.2.16-beta-ca2f5282c7-260921143311"
67781
+ pluginVersion: "0.2.16"
67719
67782
  });
67720
67783
  }
67721
67784
  logWithTimestamp(
@@ -70488,7 +70551,7 @@ async function exportDiagnosticLogs(options) {
70488
70551
  node: process.version,
70489
70552
  platform: process.platform,
70490
70553
  arch: process.arch,
70491
- packageVersion: true ? "0.2.16-beta-ca2f5282c7-260921143311" : "unknown",
70554
+ packageVersion: true ? "0.2.16" : "unknown",
70492
70555
  sensitiveContentIncluded: options.includeSensitiveContent,
70493
70556
  listenerAndLlmContentIncluded: true,
70494
70557
  credentialsAlwaysRedacted: true,
@@ -72400,7 +72463,7 @@ async function runDoctor(options = {}) {
72400
72463
  platform: options.platform ?? process.platform,
72401
72464
  env: options.env ?? process.env,
72402
72465
  target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
72403
- cliVersion: options.cliVersion ?? (true ? "0.2.16-beta-ca2f5282c7-260921143311" : "0.0.0"),
72466
+ cliVersion: options.cliVersion ?? (true ? "0.2.16" : "0.0.0"),
72404
72467
  fixMode: options.fix === true,
72405
72468
  nonInteractive: options.nonInteractive === true,
72406
72469
  packageChanged: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okxweb3/a2a-node",
3
- "version": "0.2.16-beta-ca2f5282c7-260921143311",
3
+ "version": "0.2.16",
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": {