@okxweb3/a2a-node 0.2.7 → 0.2.8-beta-912b775358-260818171144

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 +807 -159
  2. package/dist/index.js +770 -139
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3807,7 +3807,7 @@ var require_is = __commonJS({
3807
3807
  function isPrimitive(wat) {
3808
3808
  return wat === null || typeof wat !== "object" && typeof wat !== "function";
3809
3809
  }
3810
- function isPlainObject4(wat) {
3810
+ function isPlainObject6(wat) {
3811
3811
  return isBuiltin(wat, "Object");
3812
3812
  }
3813
3813
  function isEvent(wat) {
@@ -3823,7 +3823,7 @@ var require_is = __commonJS({
3823
3823
  return Boolean(wat && wat.then && typeof wat.then === "function");
3824
3824
  }
3825
3825
  function isSyntheticEvent(wat) {
3826
- return isPlainObject4(wat) && "nativeEvent" in wat && "preventDefault" in wat && "stopPropagation" in wat;
3826
+ return isPlainObject6(wat) && "nativeEvent" in wat && "preventDefault" in wat && "stopPropagation" in wat;
3827
3827
  }
3828
3828
  function isNaN2(wat) {
3829
3829
  return typeof wat === "number" && wat !== wat;
@@ -3846,7 +3846,7 @@ var require_is = __commonJS({
3846
3846
  exports2.isEvent = isEvent;
3847
3847
  exports2.isInstanceOf = isInstanceOf;
3848
3848
  exports2.isNaN = isNaN2;
3849
- exports2.isPlainObject = isPlainObject4;
3849
+ exports2.isPlainObject = isPlainObject6;
3850
3850
  exports2.isPrimitive = isPrimitive;
3851
3851
  exports2.isRegExp = isRegExp;
3852
3852
  exports2.isString = isString;
@@ -5654,10 +5654,10 @@ var require_path = __commonJS({
5654
5654
  function isAbsolute4(path2) {
5655
5655
  return path2.charAt(0) === "/";
5656
5656
  }
5657
- function join31(...args) {
5657
+ function join32(...args) {
5658
5658
  return normalizePath(args.join("/"));
5659
5659
  }
5660
- function dirname10(path2) {
5660
+ function dirname11(path2) {
5661
5661
  const result = splitPath(path2);
5662
5662
  const root = result[0];
5663
5663
  let dir = result[1];
@@ -5677,9 +5677,9 @@ var require_path = __commonJS({
5677
5677
  return f;
5678
5678
  }
5679
5679
  exports2.basename = basename8;
5680
- exports2.dirname = dirname10;
5680
+ exports2.dirname = dirname11;
5681
5681
  exports2.isAbsolute = isAbsolute4;
5682
- exports2.join = join31;
5682
+ exports2.join = join32;
5683
5683
  exports2.normalizePath = normalizePath;
5684
5684
  exports2.relative = relative;
5685
5685
  exports2.resolve = resolve11;
@@ -19098,6 +19098,15 @@ var init_events = __esm({
19098
19098
  SYSTEM_NOTIFICATION_ROUTED: "System notification routed",
19099
19099
  HERMES_SESSION_ROUTE_BINDING: "Hermes session route binding",
19100
19100
  DOCTOR_REPORT: "Doctor report",
19101
+ // Paginated WakeupNotify recovery (BL-011) + bounded AI concurrency telemetry.
19102
+ // All info-level events below must ALSO be listed in SENTRY_INFO_ALLOWLIST
19103
+ // (index.ts) or info() drops them silently.
19104
+ WAKEUP_PULL_STARTED: "WakeupNotify pull started",
19105
+ WAKEUP_PULL_PAGE_FETCHED: "WakeupNotify pull page fetched",
19106
+ WAKEUP_PULL_PAGE_RETRY: "WakeupNotify pull page retry",
19107
+ WAKEUP_PULL_COMPLETED: "WakeupNotify pull completed",
19108
+ WAKEUP_NOTIFICATION_REJECTED: "WakeupNotify notification rejected",
19109
+ AI_CONCURRENCY_SNAPSHOT: "AI concurrency snapshot",
19101
19110
  // ── error ─────────────────────────────────────────────────────
19102
19111
  XMTP_CONNECTION_FAILED: "XMTP connection failed",
19103
19112
  CONVERSATIONS_STREAM_FAILED: "conversations.stream failed",
@@ -19152,6 +19161,7 @@ var init_events = __esm({
19152
19161
  AI_RUN_TOOL_FAILED: "AI run tool failed",
19153
19162
  IPC_FAILED: "IPC failed",
19154
19163
  NOTIFY_AGENTS_WAKEUP_FAILED: "Notify agents wakeup failed",
19164
+ WAKEUP_PULL_FAILED: "WakeupNotify pull failed",
19155
19165
  OUTBOUND_AGENT_LOOKUP_FAILED: "Outbound agent lookup failed",
19156
19166
  OUTBOUND_ELIGIBILITY_CHECK_FAILED: "Outbound eligibility check failed",
19157
19167
  OUTBOUND_ELIGIBILITY_BYPASSED: "Outbound eligibility bypassed",
@@ -19872,6 +19882,13 @@ var init_sentry_logger = __esm({
19872
19882
  LogEvent.USER_CHANNEL_MESSAGE_DELIVERED,
19873
19883
  LogEvent.SYSTEM_NOTIFICATION_RECEIVED,
19874
19884
  LogEvent.SYSTEM_NOTIFICATION_ROUTED,
19885
+ // Paginated WakeupNotify recovery (BL-011) + bounded AI concurrency telemetry.
19886
+ LogEvent.WAKEUP_PULL_STARTED,
19887
+ LogEvent.WAKEUP_PULL_PAGE_FETCHED,
19888
+ LogEvent.WAKEUP_PULL_PAGE_RETRY,
19889
+ LogEvent.WAKEUP_PULL_COMPLETED,
19890
+ LogEvent.WAKEUP_NOTIFICATION_REJECTED,
19891
+ LogEvent.AI_CONCURRENCY_SNAPSHOT,
19875
19892
  LogEvent.HERMES_SESSION_ROUTE_BINDING,
19876
19893
  LogEvent.INBOUND_BLOCKED_ADDRESS_MISMATCH,
19877
19894
  LogEvent.INBOUND_BLOCKED_INELIGIBLE,
@@ -30698,7 +30715,7 @@ var require_websocket2 = __commonJS({
30698
30715
  var http2 = require("http");
30699
30716
  var net = require("net");
30700
30717
  var tls = require("tls");
30701
- var { randomBytes: randomBytes3, createHash: createHash6 } = require("crypto");
30718
+ var { randomBytes: randomBytes3, createHash: createHash7 } = require("crypto");
30702
30719
  var { Duplex, Readable } = require("stream");
30703
30720
  var { URL: URL2 } = require("url");
30704
30721
  var PerMessageDeflate = require_permessage_deflate();
@@ -31358,7 +31375,7 @@ var require_websocket2 = __commonJS({
31358
31375
  abortHandshake(websocket, socket, "Invalid Upgrade header");
31359
31376
  return;
31360
31377
  }
31361
- const digest = createHash6("sha1").update(key + GUID).digest("base64");
31378
+ const digest = createHash7("sha1").update(key + GUID).digest("base64");
31362
31379
  if (res.headers["sec-websocket-accept"] !== digest) {
31363
31380
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
31364
31381
  return;
@@ -31725,7 +31742,7 @@ var require_websocket_server = __commonJS({
31725
31742
  var EventEmitter2 = require("events");
31726
31743
  var http2 = require("http");
31727
31744
  var { Duplex } = require("stream");
31728
- var { createHash: createHash6 } = require("crypto");
31745
+ var { createHash: createHash7 } = require("crypto");
31729
31746
  var extension = require_extension();
31730
31747
  var PerMessageDeflate = require_permessage_deflate();
31731
31748
  var subprotocol = require_subprotocol();
@@ -32026,7 +32043,7 @@ var require_websocket_server = __commonJS({
32026
32043
  );
32027
32044
  }
32028
32045
  if (this._state > RUNNING) return abortHandshake(socket, 503);
32029
- const digest = createHash6("sha1").update(key + GUID).digest("base64");
32046
+ const digest = createHash7("sha1").update(key + GUID).digest("base64");
32030
32047
  const headers = [
32031
32048
  "HTTP/1.1 101 Switching Protocols",
32032
32049
  "Upgrade: websocket",
@@ -32148,7 +32165,7 @@ var init_sentry_config = __esm({
32148
32165
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
32149
32166
  SENTRY_CONFIG = {
32150
32167
  projectName: "okx/openclaw-okx-a2a-extension",
32151
- release: "0.2.7",
32168
+ release: "0.2.8-beta-912b775358-260818171144",
32152
32169
  environment,
32153
32170
  runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
32154
32171
  };
@@ -32259,13 +32276,13 @@ async function installWindowsNativeLauncher(options) {
32259
32276
  if (!(0, import_node_fs21.existsSync)(nodeExe)) {
32260
32277
  throw new Error(`cannot build okx-a2a.exe: node executable not found at ${nodeExe}`);
32261
32278
  }
32262
- const exePath = (0, import_node_path27.join)(options.targetDir, NATIVE_LAUNCHER_EXE_NAME);
32279
+ const exePath = (0, import_node_path28.join)(options.targetDir, NATIVE_LAUNCHER_EXE_NAME);
32263
32280
  (0, import_node_fs21.mkdirSync)(options.targetDir, { recursive: true });
32264
- const work = (0, import_node_fs21.mkdtempSync)((0, import_node_path27.join)((0, import_node_os10.tmpdir)(), "okx-a2a-sea-"));
32281
+ const work = (0, import_node_fs21.mkdtempSync)((0, import_node_path28.join)((0, import_node_os10.tmpdir)(), "okx-a2a-sea-"));
32265
32282
  try {
32266
- const entryPath = (0, import_node_path27.join)(work, "launcher-entry.js");
32267
- const blobPath = (0, import_node_path27.join)(work, "okx-a2a.blob");
32268
- const configPath = (0, import_node_path27.join)(work, "sea-config.json");
32283
+ const entryPath = (0, import_node_path28.join)(work, "launcher-entry.js");
32284
+ const blobPath = (0, import_node_path28.join)(work, "okx-a2a.blob");
32285
+ const configPath = (0, import_node_path28.join)(work, "sea-config.json");
32269
32286
  (0, import_node_fs21.writeFileSync)(entryPath, buildLauncherEntryJs(options.cliPath), "utf8");
32270
32287
  (0, import_node_fs21.writeFileSync)(configPath, buildSeaConfig(entryPath, blobPath), "utf8");
32271
32288
  (0, import_node_child_process7.execFileSync)(nodeExe, ["--experimental-sea-config", configPath], {
@@ -32298,13 +32315,13 @@ async function installWindowsNativeLauncher(options) {
32298
32315
  function findWindowsNativeOkxA2aExe(pathValue, appData, userProfile, fileExists2 = import_node_fs21.existsSync) {
32299
32316
  const dirs = pathValue.split(";").map((d) => d.trim()).filter(Boolean);
32300
32317
  if (appData) {
32301
- dirs.push((0, import_node_path27.join)(appData, "npm"));
32318
+ dirs.push((0, import_node_path28.join)(appData, "npm"));
32302
32319
  }
32303
32320
  if (userProfile) {
32304
- dirs.push((0, import_node_path27.join)(userProfile, ".local", "bin"));
32321
+ dirs.push((0, import_node_path28.join)(userProfile, ".local", "bin"));
32305
32322
  }
32306
32323
  for (const dir of dirs) {
32307
- const candidate = (0, import_node_path27.join)(dir, NATIVE_LAUNCHER_EXE_NAME);
32324
+ const candidate = (0, import_node_path28.join)(dir, NATIVE_LAUNCHER_EXE_NAME);
32308
32325
  if (fileExists2(candidate)) {
32309
32326
  return candidate;
32310
32327
  }
@@ -32316,7 +32333,7 @@ function resolveRunningCliPath() {
32316
32333
  if (fromArgv && /(?:^|[\\/])cli\.js$/.test(fromArgv) && (0, import_node_fs21.existsSync)(fromArgv)) {
32317
32334
  return fromArgv;
32318
32335
  }
32319
- const beside = (0, import_node_path27.join)(__dirname, "cli.js");
32336
+ const beside = (0, import_node_path28.join)(__dirname, "cli.js");
32320
32337
  if ((0, import_node_fs21.existsSync)(beside)) {
32321
32338
  return beside;
32322
32339
  }
@@ -32335,11 +32352,11 @@ async function ensureWindowsNativeLauncher(options = {}) {
32335
32352
  if (existing) {
32336
32353
  return { exePath: existing, installed: false };
32337
32354
  }
32338
- const targetDir = env.APPDATA ? (0, import_node_path27.join)(env.APPDATA, "npm") : (0, import_node_path27.join)(env.USERPROFILE ?? (0, import_node_os10.homedir)(), ".local", "bin");
32355
+ const targetDir = env.APPDATA ? (0, import_node_path28.join)(env.APPDATA, "npm") : (0, import_node_path28.join)(env.USERPROFILE ?? (0, import_node_os10.homedir)(), ".local", "bin");
32339
32356
  const result = await installWindowsNativeLauncher({ cliPath: resolveRunningCliPath(), targetDir });
32340
32357
  return { exePath: result.exePath, installed: true };
32341
32358
  }
32342
- var import_node_child_process7, import_node_fs21, import_node_module, import_node_os10, import_node_path27, SEA_SENTINEL_FUSE, NATIVE_LAUNCHER_EXE_NAME, POSTJECT_SPEC, POSTJECT_BIN;
32359
+ var import_node_child_process7, import_node_fs21, import_node_module, import_node_os10, import_node_path28, SEA_SENTINEL_FUSE, NATIVE_LAUNCHER_EXE_NAME, POSTJECT_SPEC, POSTJECT_BIN;
32343
32360
  var init_win_native_launcher = __esm({
32344
32361
  "src/win-native-launcher.ts"() {
32345
32362
  "use strict";
@@ -32347,7 +32364,7 @@ var init_win_native_launcher = __esm({
32347
32364
  import_node_fs21 = require("node:fs");
32348
32365
  import_node_module = require("node:module");
32349
32366
  import_node_os10 = require("node:os");
32350
- import_node_path27 = require("node:path");
32367
+ import_node_path28 = require("node:path");
32351
32368
  init_win_compat();
32352
32369
  init_win_spawn();
32353
32370
  SEA_SENTINEL_FUSE = "NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2";
@@ -33089,7 +33106,7 @@ async function getCurrentNodeCliVersion() {
33089
33106
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
33090
33107
  }
33091
33108
  function getBundledNodeCliVersion() {
33092
- return true ? "0.2.7" : null;
33109
+ return true ? "0.2.8-beta-912b775358-260818171144" : null;
33093
33110
  }
33094
33111
  function readConfiguredAiProvider() {
33095
33112
  const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
@@ -33274,17 +33291,17 @@ async function updateHermes(release, options) {
33274
33291
  assertNotRunningInsideGateway("hermes");
33275
33292
  }
33276
33293
  const spec = buildNpmPackageSpec("hermes", release);
33277
- const workDir = await (0, import_promises11.mkdtemp)((0, import_node_path28.join)((0, import_node_os11.tmpdir)(), `okx-a2a-${label}-hermes-`));
33294
+ const workDir = await (0, import_promises11.mkdtemp)((0, import_node_path29.join)((0, import_node_os11.tmpdir)(), `okx-a2a-${label}-hermes-`));
33278
33295
  try {
33279
33296
  console.log(`[${label}] downloading ${spec}`);
33280
33297
  const npmTarball = await npmPack(spec, workDir);
33281
- const npmPackageDir = (0, import_node_path28.join)(workDir, "npm-package");
33298
+ const npmPackageDir = (0, import_node_path29.join)(workDir, "npm-package");
33282
33299
  await runCommand("tar", ["-xzf", npmTarball, "-C", npmPackageDir], { ensureDir: npmPackageDir });
33283
- const pluginTarball = await findHermesPluginTarball((0, import_node_path28.join)(npmPackageDir, "package", "dist"));
33284
- const pluginDir = (0, import_node_path28.join)(workDir, "plugin");
33300
+ const pluginTarball = await findHermesPluginTarball((0, import_node_path29.join)(npmPackageDir, "package", "dist"));
33301
+ const pluginDir = (0, import_node_path29.join)(workDir, "plugin");
33285
33302
  await runCommand("tar", ["-xzf", pluginTarball, "-C", pluginDir], { ensureDir: pluginDir });
33286
33303
  const unpackedPluginDir = await findFirstDirectory(pluginDir);
33287
- const installer = (0, import_node_path28.join)(unpackedPluginDir, "scripts", "install-or-upgrade.sh");
33304
+ const installer = (0, import_node_path29.join)(unpackedPluginDir, "scripts", "install-or-upgrade.sh");
33288
33305
  console.log(`[${label}] running ${installer}`);
33289
33306
  await runCommand("bash", [installer, ...options.restart ? ["--restart"] : []], { cwd: unpackedPluginDir });
33290
33307
  await normalizeHermesOkxA2aPluginConfig();
@@ -33299,7 +33316,7 @@ async function updateHermes(release, options) {
33299
33316
  }
33300
33317
  }
33301
33318
  async function installGatewayPluginForDoctor(target) {
33302
- const release = isPrereleaseVersion("0.2.7") ? "beta" : "latest";
33319
+ const release = isPrereleaseVersion("0.2.8-beta-912b775358-260818171144") ? "beta" : "latest";
33303
33320
  const insideTargetGateway = detectGatewayInvocation() === target;
33304
33321
  const options = {
33305
33322
  restart: !insideTargetGateway,
@@ -33350,7 +33367,7 @@ async function ensureHermesOkxA2aPluginConfig(configFile = resolveHermesConfigPa
33350
33367
  if (options.dryRun) {
33351
33368
  return true;
33352
33369
  }
33353
- await (0, import_promises11.mkdir)((0, import_node_path28.resolve)(configFile, ".."), { recursive: true });
33370
+ await (0, import_promises11.mkdir)((0, import_node_path29.resolve)(configFile, ".."), { recursive: true });
33354
33371
  await (0, import_promises11.writeFile)(configFile, "plugins:\n enabled:\n - okx-a2a\n");
33355
33372
  console.log(`[update] added Hermes plugins.enabled okx-a2a entry in ${configFile}`);
33356
33373
  return true;
@@ -33590,7 +33607,7 @@ function findFirstEnabledListItem(lines, startIndex, enabledIndent) {
33590
33607
  return null;
33591
33608
  }
33592
33609
  function resolveHermesConfigPath() {
33593
- return (0, import_node_path28.join)(process.env.HERMES_HOME ?? (0, import_node_path28.join)((0, import_node_os11.homedir)(), ".hermes"), "config.yaml");
33610
+ return (0, import_node_path29.join)(process.env.HERMES_HOME ?? (0, import_node_path29.join)((0, import_node_os11.homedir)(), ".hermes"), "config.yaml");
33594
33611
  }
33595
33612
  function lineIndent(line) {
33596
33613
  const match = line.match(/^\s*/);
@@ -33668,7 +33685,7 @@ async function assertGatewayPluginInstalled(target) {
33668
33685
  );
33669
33686
  }
33670
33687
  function resolveHermesPluginYamlPath() {
33671
- return (0, import_node_path28.join)(process.env.HERMES_HOME ?? (0, import_node_path28.join)((0, import_node_os11.homedir)(), ".hermes"), "plugins", "platforms", "okx-a2a", "plugin.yaml");
33688
+ return (0, import_node_path29.join)(process.env.HERMES_HOME ?? (0, import_node_path29.join)((0, import_node_os11.homedir)(), ".hermes"), "plugins", "platforms", "okx-a2a", "plugin.yaml");
33672
33689
  }
33673
33690
  async function isGatewayPluginInstalled(target) {
33674
33691
  if (target === "openclaw") {
@@ -33761,7 +33778,7 @@ function parsePackageVersionFromText(output) {
33761
33778
  return output.match(/@okxweb3\/a2a-openclaw@([0-9A-Za-z.+-]+)/)?.[1] ?? null;
33762
33779
  }
33763
33780
  async function getInstalledHermesPluginVersion() {
33764
- const pluginYaml = (0, import_node_path28.join)(process.env.HERMES_HOME ?? (0, import_node_path28.join)((0, import_node_os11.homedir)(), ".hermes"), "plugins", "platforms", "okx-a2a", "plugin.yaml");
33781
+ const pluginYaml = (0, import_node_path29.join)(process.env.HERMES_HOME ?? (0, import_node_path29.join)((0, import_node_os11.homedir)(), ".hermes"), "plugins", "platforms", "okx-a2a", "plugin.yaml");
33765
33782
  try {
33766
33783
  const content = await (0, import_promises11.readFile)(pluginYaml, "utf8");
33767
33784
  return parsePluginYamlVersion(content);
@@ -33819,7 +33836,7 @@ async function npmPack(spec, destination) {
33819
33836
  if (!tarballName) {
33820
33837
  throw new Error(`Unable to detect npm pack tarball from output: ${output.trim()}`);
33821
33838
  }
33822
- return (0, import_node_path28.resolve)(destination, (0, import_node_path28.basename)(tarballName));
33839
+ return (0, import_node_path29.resolve)(destination, (0, import_node_path29.basename)(tarballName));
33823
33840
  }
33824
33841
  async function findHermesPluginTarball(distDir) {
33825
33842
  const entries = await (0, import_promises11.readdir)(distDir);
@@ -33827,7 +33844,7 @@ async function findHermesPluginTarball(distDir) {
33827
33844
  if (!tarball) {
33828
33845
  throw new Error(`Hermes npm package did not contain dist/okx-a2a-hermes-plugin-*.tar.gz`);
33829
33846
  }
33830
- return (0, import_node_path28.join)(distDir, tarball);
33847
+ return (0, import_node_path29.join)(distDir, tarball);
33831
33848
  }
33832
33849
  async function findFirstDirectory(parent) {
33833
33850
  const entries = await (0, import_promises11.readdir)(parent, { withFileTypes: true });
@@ -33835,7 +33852,7 @@ async function findFirstDirectory(parent) {
33835
33852
  if (!dir) {
33836
33853
  throw new Error(`No unpacked plugin directory found under ${parent}`);
33837
33854
  }
33838
- return (0, import_node_path28.join)(parent, dir.name);
33855
+ return (0, import_node_path29.join)(parent, dir.name);
33839
33856
  }
33840
33857
  function readOption2(args, name) {
33841
33858
  const index2 = args.indexOf(name);
@@ -34056,7 +34073,7 @@ function buildExternalCommandInvocation(command, args, platform = process.platfo
34056
34073
  function formatExternalCommand(command, args) {
34057
34074
  return [command, ...args].join(" ");
34058
34075
  }
34059
- var import_node_child_process8, import_node_fs22, import_promises11, import_node_os11, import_node_path28, 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, PROVIDER_CLI_AUTH_PROBE_TIMEOUT_MS, SetupBlockedError, redirectCommandStdoutToStderr;
34076
+ var import_node_child_process8, import_node_fs22, import_promises11, import_node_os11, import_node_path29, 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, PROVIDER_CLI_AUTH_PROBE_TIMEOUT_MS, SetupBlockedError, redirectCommandStdoutToStderr;
34060
34077
  var init_update_cli = __esm({
34061
34078
  "src/update-cli.ts"() {
34062
34079
  "use strict";
@@ -34064,7 +34081,7 @@ var init_update_cli = __esm({
34064
34081
  import_node_fs22 = require("node:fs");
34065
34082
  import_promises11 = require("node:fs/promises");
34066
34083
  import_node_os11 = require("node:os");
34067
- import_node_path28 = require("node:path");
34084
+ import_node_path29 = require("node:path");
34068
34085
  init_ai_command();
34069
34086
  init_win_spawn();
34070
34087
  init_ai_provider();
@@ -34377,7 +34394,7 @@ var require_BufferList = __commonJS({
34377
34394
  this.head = this.tail = null;
34378
34395
  this.length = 0;
34379
34396
  };
34380
- BufferList.prototype.join = function join31(s) {
34397
+ BufferList.prototype.join = function join32(s) {
34381
34398
  if (this.length === 0) return "";
34382
34399
  var p = this.head;
34383
34400
  var ret = "" + p.data;
@@ -44005,6 +44022,7 @@ __export(index_exports, {
44005
44022
  CODEX_RECOVERY_ACTIONS: () => CODEX_RECOVERY_ACTIONS,
44006
44023
  CommandStore: () => CommandStore,
44007
44024
  DEFAULT_AI_PERMISSION_PRESET: () => DEFAULT_AI_PERMISSION_PRESET,
44025
+ DEFAULT_MAX_ACTIVE_AI_EXECUTIONS: () => DEFAULT_MAX_ACTIVE_AI_EXECUTIONS,
44008
44026
  DEFAULT_OFFLINE_REPLAY_INTERVAL_SEC: () => DEFAULT_OFFLINE_REPLAY_INTERVAL_SEC,
44009
44027
  DEFAULT_XMTP_CLIENT_RECYCLE_INTERVAL_SEC: () => DEFAULT_XMTP_CLIENT_RECYCLE_INTERVAL_SEC,
44010
44028
  DOCTOR_MIN_NODE_VERSION: () => DOCTOR_MIN_NODE_VERSION,
@@ -44033,7 +44051,9 @@ __export(index_exports, {
44033
44051
  USER_ATTENTION_WATCH_PARENT_CHECK_MS: () => USER_ATTENTION_WATCH_PARENT_CHECK_MS,
44034
44052
  USER_ATTENTION_WATCH_REPLACED_MESSAGE: () => USER_ATTENTION_WATCH_REPLACED_MESSAGE,
44035
44053
  UserCancelledAiProviderSelectionError: () => UserCancelledAiProviderSelectionError,
44054
+ WAKEUP_PAGE_SIZE: () => WAKEUP_PAGE_SIZE,
44036
44055
  WALLET_STATUS_TIMEOUT_MS: () => WALLET_STATUS_TIMEOUT_MS,
44056
+ WakeupDedupeStore: () => WakeupDedupeStore,
44037
44057
  XMTP_CLIENT_RECYCLE_INTERVAL_ENV: () => XMTP_CLIENT_RECYCLE_INTERVAL_ENV,
44038
44058
  XmtpDm: () => Dm,
44039
44059
  XmtpGroup: () => Group,
@@ -44097,9 +44117,11 @@ __export(index_exports, {
44097
44117
  commandExists: () => commandExists,
44098
44118
  createAiToolFailureTracker: () => createAiToolFailureTracker,
44099
44119
  createFileMessageHandler: () => createFileMessageHandler,
44120
+ createOnchainosWakeupFetchPage: () => createOnchainosWakeupFetchPage,
44100
44121
  createOutboundBehavior: () => createOutboundBehavior,
44101
44122
  createUserAttentionWatchParentMonitor: () => createUserAttentionWatchParentMonitor,
44102
44123
  currentOpenClawGatewaySessionKey: () => currentOpenClawGatewaySessionKey,
44124
+ deriveWakeupDedupeKey: () => deriveWakeupDedupeKey,
44103
44125
  detectAiProviders: () => detectAiProviders,
44104
44126
  detectCurrentAiProvider: () => detectCurrentAiProvider,
44105
44127
  detectGatewayInvocation: () => detectGatewayInvocation,
@@ -44114,7 +44136,9 @@ __export(index_exports, {
44114
44136
  exportDiagnosticLogs: () => exportDiagnosticLogs,
44115
44137
  extractAiSessionId: () => extractAiSessionId,
44116
44138
  extractDirectToUserNotification: () => extractDirectToUserNotification,
44139
+ extractSystemNotification: () => extractSystemNotification,
44117
44140
  extractXmtpSentAtMs: () => extractXmtpSentAtMs2,
44141
+ fetchAllWakeupNotifications: () => fetchAllWakeupNotifications,
44118
44142
  findWindowsNativeOkxA2aExe: () => findWindowsNativeOkxA2aExe,
44119
44143
  followFile: () => followFile,
44120
44144
  formatDoctorReportForHumans: () => formatDoctorReportForHumans,
@@ -44131,6 +44155,7 @@ __export(index_exports, {
44131
44155
  hashDiagnosticFileContent: () => hashDiagnosticFileContent,
44132
44156
  heartbeatUserAttentionWatcher: () => heartbeatUserAttentionWatcher,
44133
44157
  hermesConfigEnablesOkxA2a: () => hermesConfigEnablesOkxA2a,
44158
+ ingestWakeupNotification: () => ingestWakeupNotification,
44134
44159
  installWindowsNativeLauncher: () => installWindowsNativeLauncher,
44135
44160
  installedAutostartHasCurrentConfiguration: () => installedAutostartHasCurrentConfiguration,
44136
44161
  installedAutostartHasCurrentRestartPolicy: () => installedAutostartHasCurrentRestartPolicy,
@@ -44145,12 +44170,14 @@ __export(index_exports, {
44145
44170
  isPrereleaseVersion: () => isPrereleaseVersion,
44146
44171
  isRetryableOpenClawGatewayError: () => isRetryableOpenClawGatewayError,
44147
44172
  isSqliteBusyError: () => isSqliteBusyError,
44173
+ isValidWakeupItem: () => isValidWakeupItem,
44148
44174
  isWindowsElevated: () => isWindowsElevated,
44149
44175
  killProcessTree: () => killProcessTree,
44150
44176
  launchdPlistHasCurrentRestartPolicy: () => launchdPlistHasCurrentRestartPolicy,
44151
44177
  listAllAgentsWithMetadata: () => listAllAgentsWithMetadata,
44152
44178
  logWinCompat: () => logWinCompat,
44153
44179
  logXmtpMessageSent: () => logXmtpMessageSent,
44180
+ mapCliStdoutToWakeupResponse: () => mapCliStdoutToWakeupResponse,
44154
44181
  maybeRecommendOnchainosUpgrade: () => maybeRecommendOnchainosUpgrade,
44155
44182
  mergeA2AEnvelopeTips: () => mergeA2AEnvelopeTips,
44156
44183
  messageEligibleHelpAdvertisesOfflineReplay: () => messageEligibleHelpAdvertisesOfflineReplay,
@@ -44201,6 +44228,7 @@ __export(index_exports, {
44201
44228
  resolveDirectCommunicationSessionTarget: () => resolveDirectCommunicationSessionTarget,
44202
44229
  resolveDoctorTarget: () => resolveDoctorTarget,
44203
44230
  resolveEnvelopePayload: () => resolveEnvelopePayload,
44231
+ resolveMaxActiveAiExecutions: () => resolveMaxActiveAiExecutions,
44204
44232
  resolveNpmCmdShimScript: () => resolveNpmCmdShimScript,
44205
44233
  resolveOfflineReplayCapabilityMarker: () => resolveOfflineReplayCapabilityMarker,
44206
44234
  resolveOfflineReplayIntervalSec: () => resolveOfflineReplayIntervalSec,
@@ -44230,6 +44258,7 @@ __export(index_exports, {
44230
44258
  startDaemonRespectingSupervisor: () => startDaemonRespectingSupervisor,
44231
44259
  startUserAttentionEventServer: () => startUserAttentionEventServer,
44232
44260
  startUserAttentionWatcherCoordinator: () => startUserAttentionWatcherCoordinator,
44261
+ startWakeupNotifyRecovery: () => startWakeupNotifyRecovery,
44233
44262
  stopDaemon: () => stopDaemon,
44234
44263
  stopOpenClawGateway: () => stopOpenClawGateway,
44235
44264
  subscribeUserAttentionEvents: () => subscribeUserAttentionEvents,
@@ -57938,6 +57967,10 @@ var XmtpService = class _XmtpService {
57938
57967
  timer
57939
57968
  });
57940
57969
  }
57970
+ // Public so the daemon (listener.ts) can invoke the legacy fire-and-forget wakeup
57971
+ // AFTER the command processor is ready, as one of two mutually-exclusive wakeup
57972
+ // paths (the other being the paginated WakeupNotify pull). It is intentionally no
57973
+ // longer called from completeStartupReplay — see the note there.
57941
57974
  notifyAgentsWakeupAfterReplay() {
57942
57975
  const notifyAgentsWakeup2 = this.tools.notifyAgentsWakeup;
57943
57976
  const agentIds = this.allAgents.map((agent) => agent.agentId);
@@ -57965,9 +57998,14 @@ var XmtpService = class _XmtpService {
57965
57998
  /**
57966
57999
  * Completes the startup handoff from stored history to the live stream.
57967
58000
  * Listeners are already attached, but their host handlers stay buffered
57968
- * until replay finishes and the buffer is drained. Only then do we tell
57969
- * the backend that the agents are awake, so wakeup-triggered messages
57970
- * cannot overtake the stored backlog.
58001
+ * until replay finishes and the buffer is drained.
58002
+ *
58003
+ * Telling the backend the agents are awake is deliberately NOT done here.
58004
+ * The daemon (listener.ts) triggers exactly ONE wakeup path AFTER the bounded
58005
+ * command processor is ready — the paginated WakeupNotify pull when enabled, or
58006
+ * `notifyAgentsWakeupAfterReplay()` (the legacy fire-and-forget) otherwise — so
58007
+ * the two paths never overlap and wakeup-triggered work cannot be dispatched
58008
+ * before the processor exists.
57971
58009
  */
57972
58010
  async completeStartupReplay() {
57973
58011
  const startupGates = new Map(
@@ -57982,7 +58020,6 @@ var XmtpService = class _XmtpService {
57982
58020
  }
57983
58021
  this.resolveStartupReplayCompletion?.();
57984
58022
  this.resolveStartupReplayCompletion = void 0;
57985
- this.notifyAgentsWakeupAfterReplay();
57986
58023
  return summary;
57987
58024
  }
57988
58025
  async startListeningForAddresses(addresses) {
@@ -60534,7 +60571,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
60534
60571
  client: {
60535
60572
  id: "gateway-client",
60536
60573
  displayName: "okx-a2a-node",
60537
- version: "0.2.7",
60574
+ version: "0.2.8-beta-912b775358-260818171144",
60538
60575
  platform: "node",
60539
60576
  mode: "backend",
60540
60577
  instanceId
@@ -60545,7 +60582,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
60545
60582
  commands: [],
60546
60583
  permissions: {},
60547
60584
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
60548
- userAgent: `okx-a2a-node/${"0.2.7"}`,
60585
+ userAgent: `okx-a2a-node/${"0.2.8-beta-912b775358-260818171144"}`,
60549
60586
  auth: {
60550
60587
  ...config.token ? { token: config.token } : {},
60551
60588
  ...config.password ? { password: config.password } : {}
@@ -63633,6 +63670,23 @@ function isRecord5(value) {
63633
63670
  return !!value && typeof value === "object" && !Array.isArray(value);
63634
63671
  }
63635
63672
 
63673
+ // src/ai-concurrency-config.ts
63674
+ var DEFAULT_MAX_ACTIVE_AI_EXECUTIONS = 4;
63675
+ function resolveMaxActiveAiExecutions(env = process.env) {
63676
+ const raw = env.OKX_A2A_MAX_ACTIVE_AI_EXECUTIONS ?? env.OKX_AGENT_TASK_MAX_ACTIVE_AI_EXECUTIONS;
63677
+ if (raw === void 0 || raw.trim() === "") {
63678
+ return { limit: DEFAULT_MAX_ACTIVE_AI_EXECUTIONS, anomaly: null };
63679
+ }
63680
+ const parsed = Number(raw);
63681
+ if (Number.isFinite(parsed) && Number.isInteger(parsed) && parsed > 0) {
63682
+ return { limit: parsed, anomaly: null };
63683
+ }
63684
+ return {
63685
+ limit: DEFAULT_MAX_ACTIVE_AI_EXECUTIONS,
63686
+ anomaly: `invalid value "${raw}", using default ${DEFAULT_MAX_ACTIVE_AI_EXECUTIONS}`
63687
+ };
63688
+ }
63689
+
63636
63690
  // src/command-processor.ts
63637
63691
  var DEFAULT_COMMAND_EXECUTION_TIMEOUT_MS = 5e4;
63638
63692
  var DEFAULT_COMMAND_STALE_TIMEOUT_MS = 12e4;
@@ -63686,6 +63740,17 @@ function startCommandProcessor(params) {
63686
63740
  const executionTimeoutMs = readPositiveEnv("OKX_A2A_COMMAND_EXECUTION_TIMEOUT_MS", DEFAULT_COMMAND_EXECUTION_TIMEOUT_MS);
63687
63741
  const staleTimeoutMs = readPositiveEnv("OKX_A2A_COMMAND_STALE_TIMEOUT_MS", DEFAULT_COMMAND_STALE_TIMEOUT_MS);
63688
63742
  const aiStaleTimeoutMs = readPositiveEnv("OKX_A2A_AI_COMMAND_STALE_TIMEOUT_MS", DEFAULT_AI_COMMAND_STALE_TIMEOUT_MS);
63743
+ const { limit: maxActiveAiExecutions, anomaly: aiLimitAnomaly } = resolveMaxActiveAiExecutions(process.env);
63744
+ if (aiLimitAnomaly) {
63745
+ logWithTimestamp(`[okx-agent-task] AI concurrency limit config anomaly: ${aiLimitAnomaly}`);
63746
+ logger.info(LogEvent.AI_CONCURRENCY_SNAPSHOT, {
63747
+ component: "node_command_processor",
63748
+ stage: "config",
63749
+ reason: "invalid_config_using_default",
63750
+ configuredLimit: String(maxActiveAiExecutions),
63751
+ anomaly: aiLimitAnomaly
63752
+ });
63753
+ }
63689
63754
  let inFlight = false;
63690
63755
  let aiScanInFlight = false;
63691
63756
  const activeAiQueueKeys = /* @__PURE__ */ new Set();
@@ -63775,6 +63840,9 @@ function startCommandProcessor(params) {
63775
63840
  inFlight = false;
63776
63841
  }
63777
63842
  };
63843
+ const AI_SNAPSHOT_MIN_INTERVAL_MS = 15e3;
63844
+ let lastAiSnapshotSignature = "";
63845
+ let lastAiSnapshotAtMs = 0;
63778
63846
  const aiTick = async () => {
63779
63847
  if (aiScanInFlight) {
63780
63848
  return;
@@ -63787,15 +63855,33 @@ function startCommandProcessor(params) {
63787
63855
  skipCommandIds: activeAiCommandIds
63788
63856
  });
63789
63857
  const pending = await commands.listPendingEntries();
63858
+ const pendingAi = pending.filter((entry) => isAiDispatchCommand(entry.command));
63859
+ if (activeAiCommandIds.size > 0 || pendingAi.length > 0) {
63860
+ const snapshotNow = Date.now();
63861
+ const oldestQueuedAgeMs = pendingAi.reduce((oldest, entry) => {
63862
+ const createdAt = Number.isFinite(entry.command.createdAt) ? entry.command.createdAt : entry.mtimeMs;
63863
+ return Math.max(oldest, snapshotNow - createdAt);
63864
+ }, 0);
63865
+ const snapshotSignature = `${maxActiveAiExecutions}|${activeAiCommandIds.size}|${pendingAi.length}`;
63866
+ if (snapshotSignature !== lastAiSnapshotSignature || snapshotNow - lastAiSnapshotAtMs >= AI_SNAPSHOT_MIN_INTERVAL_MS) {
63867
+ lastAiSnapshotSignature = snapshotSignature;
63868
+ lastAiSnapshotAtMs = snapshotNow;
63869
+ logger.info(LogEvent.AI_CONCURRENCY_SNAPSHOT, {
63870
+ component: "node_command_processor",
63871
+ configuredLimit: String(maxActiveAiExecutions),
63872
+ activeCount: String(activeAiCommandIds.size),
63873
+ queueDepth: String(pendingAi.length),
63874
+ oldestQueuedAgeMs: String(oldestQueuedAgeMs)
63875
+ });
63876
+ }
63877
+ } else {
63878
+ lastAiSnapshotSignature = "";
63879
+ }
63790
63880
  for (const entry of pending) {
63791
63881
  const command = entry.command;
63792
63882
  if (!isAiDispatchCommand(command)) {
63793
63883
  continue;
63794
63884
  }
63795
- const queueKey = buildAiCommandQueueKey(command);
63796
- if (activeAiQueueKeys.has(queueKey)) {
63797
- continue;
63798
- }
63799
63885
  if (isStalePending(entry, aiStaleTimeoutMs)) {
63800
63886
  const message = `${command.type}/${command.kind} command expired after ${formatDuration2(Date.now() - command.createdAt)} in pending queue`;
63801
63887
  await commands.completePending(command, {
@@ -63806,13 +63892,20 @@ function startCommandProcessor(params) {
63806
63892
  stage: "pending",
63807
63893
  ageMs: Date.now() - command.createdAt,
63808
63894
  timeoutMs: aiStaleTimeoutMs,
63809
- reason: "pending_expired"
63895
+ reason: "queue_expired"
63810
63896
  }));
63811
63897
  logWithTimestamp(
63812
63898
  `[okx-agent-task] ${command.type}/${command.kind} command expired id=${command.id}: ${message}`
63813
63899
  );
63814
63900
  continue;
63815
63901
  }
63902
+ if (activeAiCommandIds.size >= maxActiveAiExecutions) {
63903
+ continue;
63904
+ }
63905
+ const queueKey = buildAiCommandQueueKey(command);
63906
+ if (activeAiQueueKeys.has(queueKey)) {
63907
+ continue;
63908
+ }
63816
63909
  const processingPath = await commands.take(command);
63817
63910
  if (!processingPath) {
63818
63911
  continue;
@@ -64385,6 +64478,9 @@ function isStalePending(entry, staleTimeoutMs) {
64385
64478
  return Date.now() - createdAt > staleTimeoutMs;
64386
64479
  }
64387
64480
  function buildAiCommandQueueKey(command) {
64481
+ if (command.jobId) {
64482
+ return `job:${command.jobId}`;
64483
+ }
64388
64484
  if (command.kind === "job-message") {
64389
64485
  return buildDispatchSessionKey(command.jobId, command.sessionAgentId);
64390
64486
  }
@@ -66029,7 +66125,7 @@ init_log();
66029
66125
  var import_node_fs19 = require("node:fs");
66030
66126
  var import_promises8 = require("node:fs/promises");
66031
66127
  var import_node_os9 = require("node:os");
66032
- var import_node_path25 = require("node:path");
66128
+ var import_node_path26 = require("node:path");
66033
66129
 
66034
66130
  // ../core/src/xmtp-sdk/onchainos/signer.ts
66035
66131
  init_log();
@@ -66138,6 +66234,150 @@ function createOnchainosSigner(agent) {
66138
66234
  // src/listener.ts
66139
66235
  init_session_store();
66140
66236
 
66237
+ // src/wakeup-recovery.ts
66238
+ init_log();
66239
+ init_sentry_logger();
66240
+
66241
+ // src/wakeup-notify-client.ts
66242
+ var import_node_crypto13 = require("node:crypto");
66243
+ var DEFAULT_MAX_PAGES = 200;
66244
+ var DEFAULT_MAX_PAGE_ATTEMPTS = 3;
66245
+ var DEFAULT_PAGE_RETRY_DELAY_MS = 500;
66246
+ var TRANSIENT_TRANSPORT_PATTERN = /timed out|timeout|ETIMEDOUT|ECONNRESET|ECONNREFUSED|ENOTFOUND|EAI_AGAIN|socket hang up|network/i;
66247
+ function isTransientTransportError(err) {
66248
+ const message = err instanceof Error ? err.message : String(err);
66249
+ return TRANSIENT_TRANSPORT_PATTERN.test(message);
66250
+ }
66251
+ function isPlainObject4(value) {
66252
+ return !!value && typeof value === "object" && !Array.isArray(value);
66253
+ }
66254
+ function isValidWakeupItem(raw) {
66255
+ if (!isPlainObject4(raw)) {
66256
+ return { ok: false, reason: "malformed_item" };
66257
+ }
66258
+ if (typeof raw.agentId !== "string" || raw.agentId.length === 0) {
66259
+ return { ok: false, reason: "missing_agent_id" };
66260
+ }
66261
+ const message = raw.message;
66262
+ if (!isPlainObject4(message) || message.source !== "system") {
66263
+ return { ok: false, reason: "not_system_notification" };
66264
+ }
66265
+ if (message.event !== "wakeup_notify") {
66266
+ return { ok: false, reason: "not_wakeup_notify" };
66267
+ }
66268
+ return {
66269
+ ok: true,
66270
+ item: { agentId: raw.agentId, message }
66271
+ };
66272
+ }
66273
+ function canonicalize(value) {
66274
+ if (Array.isArray(value)) {
66275
+ return value.map(canonicalize);
66276
+ }
66277
+ if (value && typeof value === "object") {
66278
+ const source = value;
66279
+ return Object.keys(source).sort().reduce((acc, key) => {
66280
+ acc[key] = canonicalize(source[key]);
66281
+ return acc;
66282
+ }, {});
66283
+ }
66284
+ return value;
66285
+ }
66286
+ function deriveWakeupDedupeKey(item) {
66287
+ const canonicalMessage = JSON.stringify(canonicalize(item.message ?? {}));
66288
+ const identity = `${item.agentId}
66289
+ ${canonicalMessage}`;
66290
+ return `wakeup:${(0, import_node_crypto13.createHash)("sha256").update(identity).digest("hex").slice(0, 24)}`;
66291
+ }
66292
+ async function fetchAllWakeupNotifications(opts) {
66293
+ const { agentIds, fetchPage, onPage } = opts;
66294
+ const maxPages = opts.maxPages ?? DEFAULT_MAX_PAGES;
66295
+ const maxPageAttempts = opts.maxPageAttempts ?? DEFAULT_MAX_PAGE_ATTEMPTS;
66296
+ const retryDelayMs = opts.retryDelayMs ?? DEFAULT_PAGE_RETRY_DELAY_MS;
66297
+ const sleep4 = opts.sleep ?? ((ms) => new Promise((resolve11) => setTimeout(resolve11, ms)));
66298
+ const isRetryableError = opts.isRetryableError ?? isTransientTransportError;
66299
+ const onRetry = opts.onRetry;
66300
+ const fetchPageWithRetry = async (pageNum) => {
66301
+ let attempt = 0;
66302
+ while (true) {
66303
+ attempt++;
66304
+ try {
66305
+ return await fetchPage({ agentIds, page: pageNum });
66306
+ } catch (err) {
66307
+ if (!isRetryableError(err) || attempt >= maxPageAttempts) {
66308
+ throw err;
66309
+ }
66310
+ onRetry?.({ page: pageNum, attempt, reason: "transient_transport" });
66311
+ await sleep4(retryDelayMs * attempt + Math.floor(Math.random() * (retryDelayMs + 1)));
66312
+ }
66313
+ }
66314
+ };
66315
+ const items = [];
66316
+ const rejects = [];
66317
+ const visited = /* @__PURE__ */ new Set();
66318
+ let pagesFetched = 0;
66319
+ let page = 1;
66320
+ let terminated = "empty";
66321
+ try {
66322
+ while (true) {
66323
+ const resp = await fetchPageWithRetry(page);
66324
+ pagesFetched++;
66325
+ if (resp.code !== 0) {
66326
+ terminated = "business_error";
66327
+ break;
66328
+ }
66329
+ const rawList = resp.data?.list;
66330
+ if (!Array.isArray(rawList)) {
66331
+ rejects.push({ reason: "invalid_response_list" });
66332
+ terminated = "invalid_response";
66333
+ break;
66334
+ }
66335
+ const list = rawList;
66336
+ let itemCount = 0;
66337
+ let rejectedCount = 0;
66338
+ for (const element of list) {
66339
+ const check = isValidWakeupItem(element);
66340
+ if (check.ok) {
66341
+ items.push(check.item);
66342
+ itemCount++;
66343
+ } else {
66344
+ rejects.push({ reason: check.reason });
66345
+ rejectedCount++;
66346
+ }
66347
+ }
66348
+ const nextPage = resp.data?.nextPage;
66349
+ onPage?.({ page, itemCount, rejectedCount, hasNextPage: nextPage != null });
66350
+ if (nextPage === null) {
66351
+ terminated = items.length || rejects.length ? "next_page_null" : "empty";
66352
+ break;
66353
+ }
66354
+ if (typeof nextPage !== "number" || !Number.isInteger(nextPage) || nextPage <= 0) {
66355
+ rejects.push({ reason: "invalid_next_page" });
66356
+ terminated = "invalid_response";
66357
+ break;
66358
+ }
66359
+ visited.add(page);
66360
+ page = nextPage;
66361
+ if (visited.has(page) || pagesFetched >= maxPages) {
66362
+ terminated = "max_pages";
66363
+ break;
66364
+ }
66365
+ }
66366
+ } catch {
66367
+ terminated = "transport_error";
66368
+ }
66369
+ const summary = {
66370
+ pagesFetched,
66371
+ received: items.length + rejects.length,
66372
+ persisted: 0,
66373
+ partial: 0,
66374
+ duplicates: 0,
66375
+ rejected: rejects.length,
66376
+ terminated
66377
+ };
66378
+ return { items, summary, rejects };
66379
+ }
66380
+
66141
66381
  // src/ai-dispatch-queue.ts
66142
66382
  async function enqueueAiJobMessageDispatch(params) {
66143
66383
  const commands = params.commands ?? new CommandStore(params.homeDir);
@@ -66163,11 +66403,367 @@ async function enqueueAiSessionMessageDispatch(params) {
66163
66403
  return command;
66164
66404
  }
66165
66405
 
66406
+ // src/wakeup-notify-ingest.ts
66407
+ var MAX_TARGET_ENQUEUE_ATTEMPTS = 3;
66408
+ async function ingestWakeupNotification(item, deps) {
66409
+ const dedupeKey = deriveWakeupDedupeKey(item);
66410
+ const itemJobId = item.message.jobId ?? null;
66411
+ if (deps.dedupe.has(dedupeKey)) {
66412
+ return { status: "duplicate", dedupeKey, jobId: itemJobId, targetCount: 0 };
66413
+ }
66414
+ const rawText = JSON.stringify({ agentId: item.agentId, message: item.message });
66415
+ const notif = extractSystemNotification(JSON.parse(rawText));
66416
+ if (!notif?.agentId) {
66417
+ return {
66418
+ status: "rejected",
66419
+ reason: "invalid_system_notification",
66420
+ dedupeKey,
66421
+ jobId: itemJobId,
66422
+ targetCount: 0
66423
+ };
66424
+ }
66425
+ const targets = resolveSystemNotificationTargets(
66426
+ { sessionStore: deps.sessionStore, myXmtpAddress: deps.myXmtpAddress ?? "", store: void 0 },
66427
+ notif
66428
+ );
66429
+ let succeeded = 0;
66430
+ let alreadyDelivered = 0;
66431
+ let failed = 0;
66432
+ for (const target of targets) {
66433
+ const targetKey = `${dedupeKey}:${target.sessionKey}`;
66434
+ if (deps.dedupe.has(targetKey)) {
66435
+ alreadyDelivered += 1;
66436
+ continue;
66437
+ }
66438
+ let enqueued = false;
66439
+ for (let attempt = 1; attempt <= MAX_TARGET_ENQUEUE_ATTEMPTS && !enqueued; attempt++) {
66440
+ try {
66441
+ await enqueueAiSessionMessageDispatch({
66442
+ commands: deps.commands,
66443
+ event: {
66444
+ sessionKey: target.sessionKey,
66445
+ content: rawText,
66446
+ // Stable messageId (= dedupeKey) avoids the `session-${Date.now()}`
66447
+ // intra-millisecond collision on rapid ingests.
66448
+ messageId: dedupeKey,
66449
+ jobId: target.jobId ?? null,
66450
+ agentId: target.agentId ?? null
66451
+ }
66452
+ });
66453
+ enqueued = true;
66454
+ } catch {
66455
+ }
66456
+ }
66457
+ if (enqueued) {
66458
+ try {
66459
+ deps.dedupe.recordIfNew(targetKey);
66460
+ } catch {
66461
+ }
66462
+ succeeded += 1;
66463
+ } else {
66464
+ failed += 1;
66465
+ }
66466
+ }
66467
+ const delivered = succeeded + alreadyDelivered;
66468
+ if (targets.length > 0 && delivered === 0) {
66469
+ return {
66470
+ status: "rejected",
66471
+ reason: "enqueue_failed",
66472
+ dedupeKey,
66473
+ jobId: notif.jobId ?? null,
66474
+ targetCount: 0,
66475
+ failedTargetCount: failed
66476
+ };
66477
+ }
66478
+ if (failed > 0) {
66479
+ return {
66480
+ status: "partial",
66481
+ reason: "partial_enqueue",
66482
+ dedupeKey,
66483
+ jobId: notif.jobId ?? null,
66484
+ targetCount: succeeded,
66485
+ failedTargetCount: failed
66486
+ };
66487
+ }
66488
+ if (delivered === targets.length) {
66489
+ try {
66490
+ deps.dedupe.recordIfNew(dedupeKey);
66491
+ } catch {
66492
+ }
66493
+ }
66494
+ return {
66495
+ status: "persisted",
66496
+ dedupeKey,
66497
+ jobId: notif.jobId ?? null,
66498
+ targetCount: succeeded
66499
+ };
66500
+ }
66501
+
66502
+ // src/wakeup-dedupe-store.ts
66503
+ var import_node_path25 = require("node:path");
66504
+ init_paths();
66505
+ var { DatabaseSync: DatabaseSync4 } = loadSqlite4();
66506
+ var WakeupDedupeStore = class {
66507
+ db;
66508
+ dbPath;
66509
+ constructor(homeDir) {
66510
+ this.dbPath = (0, import_node_path25.join)(resolveTaskPaths(homeDir).sqliteDir, "wakeup-dedupe.sqlite");
66511
+ ensureTaskDir((0, import_node_path25.dirname)(this.dbPath));
66512
+ this.db = new DatabaseSync4(this.dbPath);
66513
+ this.ensureReady();
66514
+ }
66515
+ /**
66516
+ * Atomically record the first sighting of `key`. Returns true when the row was
66517
+ * inserted (first sighting), false when it already existed (duplicate).
66518
+ */
66519
+ recordIfNew(key) {
66520
+ const result = this.db.prepare(`
66521
+ INSERT OR IGNORE INTO wakeup_ingest_dedupe (dedupe_key, first_seen_at_ms)
66522
+ VALUES (?, ?)
66523
+ `).run(key, Date.now());
66524
+ return Number(result.changes ?? 0) > 0;
66525
+ }
66526
+ /** Pre-check used before enqueue: has this key already been recorded? */
66527
+ has(key) {
66528
+ const row = this.db.prepare("SELECT 1 FROM wakeup_ingest_dedupe WHERE dedupe_key = ? LIMIT 1").get(key);
66529
+ return row !== void 0;
66530
+ }
66531
+ remove(key) {
66532
+ this.db.prepare("DELETE FROM wakeup_ingest_dedupe WHERE dedupe_key = ?").run(key);
66533
+ }
66534
+ close() {
66535
+ this.db.close();
66536
+ }
66537
+ ensureReady() {
66538
+ this.db.exec("PRAGMA busy_timeout=5000");
66539
+ this.db.exec("PRAGMA journal_mode=WAL");
66540
+ this.db.exec(`
66541
+ CREATE TABLE IF NOT EXISTS wakeup_ingest_dedupe (
66542
+ dedupe_key TEXT PRIMARY KEY,
66543
+ first_seen_at_ms INTEGER NOT NULL
66544
+ )
66545
+ `);
66546
+ }
66547
+ };
66548
+ function loadSqlite4() {
66549
+ const originalEmitWarning = process.emitWarning;
66550
+ process.emitWarning = ((warning, ...args) => {
66551
+ const message = typeof warning === "string" ? warning : warning.message;
66552
+ if (message.includes("SQLite is an experimental feature") && args.some((arg) => arg === "ExperimentalWarning")) {
66553
+ return;
66554
+ }
66555
+ return originalEmitWarning.call(process, warning, ...args);
66556
+ });
66557
+ try {
66558
+ return require("node:sqlite");
66559
+ } finally {
66560
+ process.emitWarning = originalEmitWarning;
66561
+ }
66562
+ }
66563
+
66564
+ // src/wakeup-notify-transport.ts
66565
+ var WAKEUP_NOTIFY_CLI_COMMAND = "wakeup-notify";
66566
+ var DEFAULT_CLI_TIMEOUT_MS = 3e4;
66567
+ function withTimeout3(promise, timeoutMs, label) {
66568
+ return new Promise((resolve11, reject) => {
66569
+ const timer = setTimeout(() => {
66570
+ reject(new Error(`${label} timed out after ${timeoutMs}ms`));
66571
+ }, timeoutMs);
66572
+ promise.then(
66573
+ (value) => {
66574
+ clearTimeout(timer);
66575
+ resolve11(value);
66576
+ },
66577
+ (err) => {
66578
+ clearTimeout(timer);
66579
+ reject(err);
66580
+ }
66581
+ );
66582
+ });
66583
+ }
66584
+ function resolveCliTimeoutMs(override) {
66585
+ if (typeof override === "number" && Number.isFinite(override) && override > 0) {
66586
+ return override;
66587
+ }
66588
+ const raw = Number(process.env.OKX_A2A_WAKEUP_CLI_TIMEOUT_MS);
66589
+ return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_CLI_TIMEOUT_MS;
66590
+ }
66591
+ function isPlainObject5(value) {
66592
+ return !!value && typeof value === "object" && !Array.isArray(value);
66593
+ }
66594
+ function mapCliStdoutToWakeupResponse(parsed) {
66595
+ const root = isPlainObject5(parsed) ? parsed : {};
66596
+ const rootData = isPlainObject5(root.data) ? root.data : {};
66597
+ const nestedData = isPlainObject5(rootData.data) ? rootData.data : {};
66598
+ const candidates = [root, rootData, nestedData];
66599
+ let code;
66600
+ let msg;
66601
+ let list = [];
66602
+ let listFound = false;
66603
+ let nextPage = null;
66604
+ let nextPageFound = false;
66605
+ for (const candidate of candidates) {
66606
+ if (code === void 0 && typeof candidate.code === "number" && Number.isFinite(candidate.code)) {
66607
+ code = candidate.code;
66608
+ }
66609
+ if (msg === void 0 && typeof candidate.msg === "string") {
66610
+ msg = candidate.msg;
66611
+ }
66612
+ if (!listFound && Array.isArray(candidate.list)) {
66613
+ list = candidate.list;
66614
+ listFound = true;
66615
+ }
66616
+ if (!nextPageFound && "nextPage" in candidate) {
66617
+ const raw = candidate.nextPage;
66618
+ if (typeof raw === "number" && Number.isFinite(raw)) {
66619
+ nextPage = raw;
66620
+ nextPageFound = true;
66621
+ } else if (raw === null) {
66622
+ nextPage = null;
66623
+ nextPageFound = true;
66624
+ }
66625
+ }
66626
+ }
66627
+ if (code === void 0) {
66628
+ code = root.ok === true ? 0 : 1;
66629
+ }
66630
+ return {
66631
+ code,
66632
+ msg,
66633
+ data: { list: listFound ? list : void 0, nextPage: nextPageFound ? nextPage : void 0 }
66634
+ };
66635
+ }
66636
+ function createOnchainosWakeupFetchPage(deps = {}) {
66637
+ const timeoutMs = resolveCliTimeoutMs(deps.timeoutMs);
66638
+ const exec2 = deps.exec ?? ((args) => exec(args, { timeoutMs }));
66639
+ return async ({ agentIds, page }) => {
66640
+ const { stdout } = await withTimeout3(
66641
+ exec2([
66642
+ "agent",
66643
+ WAKEUP_NOTIFY_CLI_COMMAND,
66644
+ "--agent-ids",
66645
+ agentIds.join(","),
66646
+ // TBC: flag name/shape unconfirmed by backend/CLI.
66647
+ "--page",
66648
+ String(page)
66649
+ ]),
66650
+ timeoutMs,
66651
+ `onchainos ${WAKEUP_NOTIFY_CLI_COMMAND}`
66652
+ );
66653
+ const parsed = parseCliJson(stdout, WAKEUP_NOTIFY_CLI_COMMAND, {
66654
+ page: String(page)
66655
+ });
66656
+ return mapCliStdoutToWakeupResponse(parsed);
66657
+ };
66658
+ }
66659
+
66660
+ // src/wakeup-recovery.ts
66661
+ async function startWakeupNotifyRecovery(opts) {
66662
+ const env = opts.env ?? process.env;
66663
+ const enabled = opts.enabled ?? env.OKX_A2A_WAKEUP_PULL_ENABLED === "1";
66664
+ const fetchPage = opts.fetchPage ?? (enabled ? createOnchainosWakeupFetchPage() : void 0);
66665
+ if (!enabled || !fetchPage) {
66666
+ logWithTimestamp(
66667
+ "[okx-agent-task] WakeupNotify pull skipped (disabled or transport not configured)"
66668
+ );
66669
+ return null;
66670
+ }
66671
+ const agentIds = [
66672
+ ...new Set(
66673
+ [...opts.service.getClients().keys()].map((addr) => opts.service.getAgentByAddress(addr)?.agentId).filter((id) => typeof id === "string" && id.length > 0)
66674
+ )
66675
+ ];
66676
+ if (agentIds.length === 0) {
66677
+ logWithTimestamp("[okx-agent-task] WakeupNotify pull skipped (no active agents)");
66678
+ return null;
66679
+ }
66680
+ logger.info(LogEvent.WAKEUP_PULL_STARTED, {
66681
+ component: "wakeup_recovery",
66682
+ agentCount: String(agentIds.length)
66683
+ });
66684
+ const dedupe = new WakeupDedupeStore(opts.homeDir);
66685
+ try {
66686
+ const { items, summary, rejects } = await fetchAllWakeupNotifications({
66687
+ agentIds,
66688
+ fetchPage,
66689
+ onPage: (p) => logger.info(LogEvent.WAKEUP_PULL_PAGE_FETCHED, {
66690
+ component: "wakeup_recovery",
66691
+ page: String(p.page),
66692
+ itemCount: String(p.itemCount),
66693
+ rejectedCount: String(p.rejectedCount),
66694
+ hasNextPage: String(p.hasNextPage)
66695
+ }),
66696
+ onRetry: (r) => logger.info(LogEvent.WAKEUP_PULL_PAGE_RETRY, {
66697
+ component: "wakeup_recovery",
66698
+ page: String(r.page),
66699
+ attempt: String(r.attempt),
66700
+ reason: r.reason
66701
+ })
66702
+ });
66703
+ for (const reject of rejects) {
66704
+ logger.info(LogEvent.WAKEUP_NOTIFICATION_REJECTED, {
66705
+ component: "wakeup_recovery",
66706
+ reason: reject.reason
66707
+ });
66708
+ }
66709
+ const shouldContinue = opts.shouldContinue;
66710
+ for (const item of items) {
66711
+ if (shouldContinue && !shouldContinue()) {
66712
+ logWithTimestamp("[okx-agent-task] WakeupNotify recovery halted early (daemon stopping)");
66713
+ break;
66714
+ }
66715
+ const outcome = await ingestWakeupNotification(item, {
66716
+ commands: opts.commands,
66717
+ sessionStore: opts.sessionStore,
66718
+ dedupe,
66719
+ myXmtpAddress: void 0
66720
+ });
66721
+ if (outcome.status === "persisted") {
66722
+ summary.persisted++;
66723
+ } else if (outcome.status === "partial") {
66724
+ summary.partial++;
66725
+ logger.info(LogEvent.WAKEUP_NOTIFICATION_REJECTED, {
66726
+ component: "wakeup_recovery",
66727
+ reason: outcome.reason ?? "partial_enqueue",
66728
+ failedTargetCount: String(outcome.failedTargetCount ?? 0)
66729
+ });
66730
+ } else if (outcome.status === "duplicate") {
66731
+ summary.duplicates++;
66732
+ } else {
66733
+ summary.rejected++;
66734
+ logger.info(LogEvent.WAKEUP_NOTIFICATION_REJECTED, {
66735
+ component: "wakeup_recovery",
66736
+ reason: outcome.reason ?? "unknown"
66737
+ });
66738
+ }
66739
+ }
66740
+ if (summary.terminated === "transport_error" || summary.terminated === "business_error" || summary.terminated === "invalid_response") {
66741
+ logger.error(LogEvent.WAKEUP_PULL_FAILED, void 0, {
66742
+ component: "wakeup_recovery",
66743
+ terminated: summary.terminated
66744
+ });
66745
+ }
66746
+ logger.info(LogEvent.WAKEUP_PULL_COMPLETED, {
66747
+ component: "wakeup_recovery",
66748
+ pagesFetched: String(summary.pagesFetched),
66749
+ received: String(summary.received),
66750
+ persisted: String(summary.persisted),
66751
+ partial: String(summary.partial),
66752
+ duplicates: String(summary.duplicates),
66753
+ rejected: String(summary.rejected),
66754
+ terminated: summary.terminated
66755
+ });
66756
+ return summary;
66757
+ } finally {
66758
+ dedupe.close();
66759
+ }
66760
+ }
66761
+
66166
66762
  // src/listener.ts
66167
66763
  init_paths();
66168
66764
 
66169
66765
  // src/user-attention-watchers.ts
66170
- var import_node_crypto13 = require("node:crypto");
66766
+ var import_node_crypto14 = require("node:crypto");
66171
66767
  init_sentry_logger();
66172
66768
  var USER_ATTENTION_WATCH_REPLACED_MESSAGE = "Another okx-a2a user watch with the same job scope was started, so this watcher has been closed. Do not run this watch command again automatically, because starting another watcher may interrupt a different session that is already monitoring task progress.";
66173
66769
  var USER_ATTENTION_WATCHER_SCAN_MS = 500;
@@ -66210,7 +66806,7 @@ function isOriginalParentProcessAlive(options) {
66210
66806
  }
66211
66807
  function registerUserAttentionWatcher(options) {
66212
66808
  return options.store.registerUserAttentionWatcher({
66213
- id: options.id ?? (0, import_node_crypto13.randomUUID)(),
66809
+ id: options.id ?? (0, import_node_crypto14.randomUUID)(),
66214
66810
  provider: options.provider,
66215
66811
  jobId: options.jobId,
66216
66812
  nowMs: options.nowMs ?? Date.now(),
@@ -66494,12 +67090,12 @@ async function isGatewayAvailableForHeartbeat(options) {
66494
67090
  }
66495
67091
  async function getHermesGatewayPluginStatus(options = {}) {
66496
67092
  const env = options.env ?? process.env;
66497
- const hermesHome = env.HERMES_HOME?.trim() || (0, import_node_path25.join)((0, import_node_os9.homedir)(), ".hermes");
66498
- const pluginYamlPath = (0, import_node_path25.join)(hermesHome, "plugins", "platforms", "okx-a2a", "plugin.yaml");
67093
+ const hermesHome = env.HERMES_HOME?.trim() || (0, import_node_path26.join)((0, import_node_os9.homedir)(), ".hermes");
67094
+ const pluginYamlPath = (0, import_node_path26.join)(hermesHome, "plugins", "platforms", "okx-a2a", "plugin.yaml");
66499
67095
  if (!(0, import_node_fs19.existsSync)(pluginYamlPath)) {
66500
67096
  return { enabled: false, reason: "plugin_yaml_missing", hermesHome, checkedPath: pluginYamlPath };
66501
67097
  }
66502
- const configPath = (0, import_node_path25.join)(hermesHome, "config.yaml");
67098
+ const configPath = (0, import_node_path26.join)(hermesHome, "config.yaml");
66503
67099
  let content;
66504
67100
  try {
66505
67101
  content = await (0, import_promises8.readFile)(configPath, "utf8");
@@ -66732,12 +67328,12 @@ async function runListenerWithLock(options, paths) {
66732
67328
  });
66733
67329
  }
66734
67330
  });
66735
- service.setPluginVersion("0.2.7");
67331
+ service.setPluginVersion("0.2.8-beta-912b775358-260818171144");
66736
67332
  await service.init();
66737
67333
  const pluginVersionStatus = service.pluginVersionStatus;
66738
67334
  if (pluginVersionStatus.unavailable) {
66739
67335
  throw new Error(
66740
- `@okxweb3/a2a-node v${"0.2.7"} is below the required minimum v${pluginVersionStatus.minVersion}`
67336
+ `@okxweb3/a2a-node v${"0.2.8-beta-912b775358-260818171144"} is below the required minimum v${pluginVersionStatus.minVersion}`
66741
67337
  );
66742
67338
  }
66743
67339
  const systemConfig = service.getSystemConfig();
@@ -66755,7 +67351,7 @@ async function runListenerWithLock(options, paths) {
66755
67351
  onchainosAgentId: "*",
66756
67352
  reason: "system-config missing sentryDsn",
66757
67353
  pluginId: "@okxweb3/a2a-node",
66758
- pluginVersion: "0.2.7"
67354
+ pluginVersion: "0.2.8-beta-912b775358-260818171144"
66759
67355
  });
66760
67356
  }
66761
67357
  logWithTimestamp(
@@ -67128,6 +67724,26 @@ async function runListenerWithLock(options, paths) {
67128
67724
  });
67129
67725
  await markDaemonReady(paths.daemonLockPath);
67130
67726
  logWithTimestamp(`[okx-agent-task] daemon ready lock=${paths.daemonLockPath}`);
67727
+ if (process.env.OKX_A2A_WAKEUP_PULL_ENABLED === "1") {
67728
+ void startWakeupNotifyRecovery({
67729
+ service,
67730
+ commands,
67731
+ sessionStore,
67732
+ store,
67733
+ homeDir: options.homeDir,
67734
+ // Stop enqueuing if a shutdown begins mid-pull (fire-and-forget recovery).
67735
+ shouldContinue: () => !stopping
67736
+ }).catch((err) => {
67737
+ logger.error(LogEvent.WAKEUP_PULL_FAILED, err instanceof Error ? err : new Error(String(err)), {
67738
+ component: "node_listener",
67739
+ stage: "wakeup_recovery_start",
67740
+ reason: "wakeup_recovery_unhandled_error"
67741
+ });
67742
+ logWithTimestamp("[okx-agent-task] WakeupNotify recovery failed to start:", err);
67743
+ });
67744
+ } else {
67745
+ service.notifyAgentsWakeupAfterReplay();
67746
+ }
67131
67747
  await new Promise((resolve11) => {
67132
67748
  const shutdown2 = (signal) => {
67133
67749
  if (stopping) {
@@ -67189,7 +67805,7 @@ init_paths();
67189
67805
 
67190
67806
  // src/xmtp-test-cli.ts
67191
67807
  var import_promises10 = require("node:fs/promises");
67192
- var import_node_path26 = require("node:path");
67808
+ var import_node_path27 = require("node:path");
67193
67809
  init_daemon();
67194
67810
 
67195
67811
  // src/log-tail.ts
@@ -67432,9 +68048,9 @@ async function handleXmtpTestCommand(args, releaseInfo) {
67432
68048
  async function startXmtpTest(args, releaseInfo) {
67433
68049
  assertKnownOptions(args, /* @__PURE__ */ new Set(["--name", "--run-id", "--json"]));
67434
68050
  const paths = resolveTaskPaths();
67435
- const testsDir = (0, import_node_path26.join)(paths.homeDir, "xmtp-tests");
68051
+ const testsDir = (0, import_node_path27.join)(paths.homeDir, "xmtp-tests");
67436
68052
  await ensurePrivateDir(testsDir);
67437
- const active = await readJsonIfExists((0, import_node_path26.join)(testsDir, ACTIVE_FILE));
68053
+ const active = await readJsonIfExists((0, import_node_path27.join)(testsDir, ACTIVE_FILE));
67438
68054
  if (active?.runId) {
67439
68055
  throw new Error(
67440
68056
  `XMTP test ${active.runId} is already active. Run \`okx-a2a xmtp-test stop\` first.`
@@ -67473,7 +68089,7 @@ async function startXmtpTest(args, releaseInfo) {
67473
68089
  ...releaseInfo
67474
68090
  };
67475
68091
  await writeJson(files.manifestPath, manifest);
67476
- await writeJson((0, import_node_path26.join)(testsDir, ACTIVE_FILE), {
68092
+ await writeJson((0, import_node_path27.join)(testsDir, ACTIVE_FILE), {
67477
68093
  runId,
67478
68094
  startedAt: manifest.startedAt
67479
68095
  });
@@ -67496,7 +68112,7 @@ Run \`okx-a2a xmtp-test watch\` to open the realtime dashboard.`);
67496
68112
  async function stopXmtpTest(args) {
67497
68113
  assertKnownOptions(args, /* @__PURE__ */ new Set(["--json"]));
67498
68114
  const testsDir = resolveTestsDir();
67499
- const activePath = (0, import_node_path26.join)(testsDir, ACTIVE_FILE);
68115
+ const activePath = (0, import_node_path27.join)(testsDir, ACTIVE_FILE);
67500
68116
  const active = await readJsonIfExists(activePath);
67501
68117
  if (!active?.runId) {
67502
68118
  throw new Error("No active XMTP test.");
@@ -67790,17 +68406,17 @@ function formatJobEvent(event) {
67790
68406
  return `${timestamp} ${businessEvent.padEnd(34)} ${role}#${agent} ${source}${timings.length > 0 ? ` ${timings.join(" ")}` : ""}`;
67791
68407
  }
67792
68408
  function resolveTestsDir() {
67793
- return (0, import_node_path26.join)(resolveTaskPaths().homeDir, "xmtp-tests");
68409
+ return (0, import_node_path27.join)(resolveTaskPaths().homeDir, "xmtp-tests");
67794
68410
  }
67795
68411
  function resolveRunFiles(testsDir, runId) {
67796
68412
  validateRunId(runId);
67797
- const runDir = (0, import_node_path26.join)(testsDir, runId);
68413
+ const runDir = (0, import_node_path27.join)(testsDir, runId);
67798
68414
  return {
67799
68415
  testsDir,
67800
68416
  runDir,
67801
- manifestPath: (0, import_node_path26.join)(runDir, "manifest.json"),
67802
- eventsPath: (0, import_node_path26.join)(runDir, "events.jsonl"),
67803
- summaryPath: (0, import_node_path26.join)(runDir, "summary.json")
68417
+ manifestPath: (0, import_node_path27.join)(runDir, "manifest.json"),
68418
+ eventsPath: (0, import_node_path27.join)(runDir, "events.jsonl"),
68419
+ summaryPath: (0, import_node_path27.join)(runDir, "summary.json")
67804
68420
  };
67805
68421
  }
67806
68422
  async function resolveRequestedRunId(testsDir, args, preferActive = false) {
@@ -67808,7 +68424,7 @@ async function resolveRequestedRunId(testsDir, args, preferActive = false) {
67808
68424
  if (requested) {
67809
68425
  return validateRunId(requested);
67810
68426
  }
67811
- const active = await readJsonIfExists((0, import_node_path26.join)(testsDir, ACTIVE_FILE));
68427
+ const active = await readJsonIfExists((0, import_node_path27.join)(testsDir, ACTIVE_FILE));
67812
68428
  if (active?.runId && (preferActive || !args.includes("--latest"))) {
67813
68429
  return validateRunId(active.runId);
67814
68430
  }
@@ -67834,7 +68450,7 @@ async function findLatestRunId(testsDir) {
67834
68450
  continue;
67835
68451
  }
67836
68452
  const manifest = await readJsonIfExists(
67837
- (0, import_node_path26.join)(testsDir, entry.name, "manifest.json")
68453
+ (0, import_node_path27.join)(testsDir, entry.name, "manifest.json")
67838
68454
  );
67839
68455
  if (manifest?.runId && manifest.startedAt) {
67840
68456
  manifests.push(manifest);
@@ -68138,19 +68754,19 @@ var import_node_child_process10 = require("node:child_process");
68138
68754
  var import_node_fs27 = require("node:fs");
68139
68755
  var import_promises15 = require("node:fs/promises");
68140
68756
  var import_node_os13 = require("node:os");
68141
- var import_node_path33 = require("node:path");
68757
+ var import_node_path34 = require("node:path");
68142
68758
  var import_jszip = __toESM(require_lib3());
68143
68759
 
68144
68760
  // src/logs-export-archive.ts
68145
- var import_node_crypto14 = require("node:crypto");
68761
+ var import_node_crypto15 = require("node:crypto");
68146
68762
  var import_node_fs24 = require("node:fs");
68147
68763
  var import_promises13 = require("node:fs/promises");
68148
- var import_node_path30 = require("node:path");
68764
+ var import_node_path31 = require("node:path");
68149
68765
 
68150
68766
  // src/logs-export-filter.ts
68151
68767
  var import_node_fs23 = require("node:fs");
68152
68768
  var import_promises12 = require("node:fs/promises");
68153
- var import_node_path29 = require("node:path");
68769
+ var import_node_path30 = require("node:path");
68154
68770
  var import_node_readline2 = require("node:readline");
68155
68771
  var MAX_SINGLE_RECORD_BYTES = 2 * 1024 * 1024;
68156
68772
  var CONTENT_KEYS = /* @__PURE__ */ new Set([
@@ -68215,7 +68831,7 @@ async function readFilteredLog(path2, options, correlationIds, requireCorrelatio
68215
68831
  let excludedOutsideWindow = 0;
68216
68832
  let excludedNoCorrelation = 0;
68217
68833
  let truncated = false;
68218
- const mode = (0, import_node_path29.basename)(path2) === "llm.log" ? "llm" : recordMode;
68834
+ const mode = (0, import_node_path30.basename)(path2) === "llm.log" ? "llm" : recordMode;
68219
68835
  const filterByTime = options.fromMs !== void 0 && options.toMs !== void 0;
68220
68836
  for await (const record of streamLogRecords(path2, mode)) {
68221
68837
  if (options.jobId && recordExplicitlyNamesForeignJob(record.lines, options.jobId)) {
@@ -68679,7 +69295,7 @@ async function assertRegularFile(path2) {
68679
69295
  const file = await (0, import_promises12.lstat)(path2);
68680
69296
  if (file.isSymbolicLink() || !file.isFile()) {
68681
69297
  throw Object.assign(
68682
- new Error(`Refusing non-regular diagnostic source: ${(0, import_node_path29.basename)(path2)}`),
69298
+ new Error(`Refusing non-regular diagnostic source: ${(0, import_node_path30.basename)(path2)}`),
68683
69299
  { diagnosticUnavailable: true }
68684
69300
  );
68685
69301
  }
@@ -68760,7 +69376,7 @@ function recordCollector(state, result) {
68760
69376
  }
68761
69377
  async function resolveOutputPath(requested, input) {
68762
69378
  if (requested) {
68763
- const output2 = (0, import_node_path30.isAbsolute)(requested) ? requested : (0, import_node_path30.resolve)(input.cwd, requested);
69379
+ const output2 = (0, import_node_path31.isAbsolute)(requested) ? requested : (0, import_node_path31.resolve)(input.cwd, requested);
68764
69380
  if ((0, import_node_fs24.existsSync)(output2) && !input.overwrite) {
68765
69381
  throw new Error(`Output already exists: ${output2}. Pass --overwrite to replace it.`);
68766
69382
  }
@@ -68768,17 +69384,17 @@ async function resolveOutputPath(requested, input) {
68768
69384
  }
68769
69385
  const stamp = input.now.toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z");
68770
69386
  const base = `okx-a2a-diagnostics-${stamp}.zip`;
68771
- let output = (0, import_node_path30.join)(input.cwd, base);
69387
+ let output = (0, import_node_path31.join)(input.cwd, base);
68772
69388
  for (let suffix = 2; (0, import_node_fs24.existsSync)(output); suffix += 1) {
68773
- output = (0, import_node_path30.join)(input.cwd, `okx-a2a-diagnostics-${stamp}-${suffix}.zip`);
69389
+ output = (0, import_node_path31.join)(input.cwd, `okx-a2a-diagnostics-${stamp}-${suffix}.zip`);
68774
69390
  }
68775
69391
  return output;
68776
69392
  }
68777
69393
  async function writeArchiveAtomically(outputPath, archive, overwrite) {
68778
- await (0, import_promises13.mkdir)((0, import_node_path30.dirname)(outputPath), { recursive: true });
68779
- const temporaryPath = (0, import_node_path30.join)(
68780
- (0, import_node_path30.dirname)(outputPath),
68781
- `.${(0, import_node_path30.basename)(outputPath)}.${(0, import_node_crypto14.randomUUID)()}.tmp`
69394
+ await (0, import_promises13.mkdir)((0, import_node_path31.dirname)(outputPath), { recursive: true });
69395
+ const temporaryPath = (0, import_node_path31.join)(
69396
+ (0, import_node_path31.dirname)(outputPath),
69397
+ `.${(0, import_node_path31.basename)(outputPath)}.${(0, import_node_crypto15.randomUUID)()}.tmp`
68782
69398
  );
68783
69399
  try {
68784
69400
  await (0, import_promises13.writeFile)(temporaryPath, archive, { flag: "wx", mode: 384 });
@@ -68797,7 +69413,7 @@ async function writeArchiveAtomically(outputPath, archive, overwrite) {
68797
69413
  }
68798
69414
  }
68799
69415
  function hashDiagnosticFileContent(content) {
68800
- return (0, import_node_crypto14.createHash)("sha256").update(content).digest("hex");
69416
+ return (0, import_node_crypto15.createHash)("sha256").update(content).digest("hex");
68801
69417
  }
68802
69418
  function isUnavailableError(err) {
68803
69419
  return !!err && typeof err === "object" && "diagnosticUnavailable" in err;
@@ -68905,8 +69521,8 @@ function readSqliteRows(dbPath, sql, params = []) {
68905
69521
  if (!(0, import_node_fs25.existsSync)(dbPath)) {
68906
69522
  throw unavailable(`SQLite database not found: ${dbPath}`);
68907
69523
  }
68908
- const { DatabaseSync: DatabaseSync4 } = loadSqlite4();
68909
- const db = new DatabaseSync4(dbPath, { readOnly: true });
69524
+ const { DatabaseSync: DatabaseSync5 } = loadSqlite5();
69525
+ const db = new DatabaseSync5(dbPath, { readOnly: true });
68910
69526
  try {
68911
69527
  return db.prepare(sql).all(...params);
68912
69528
  } finally {
@@ -68924,7 +69540,7 @@ function emptySqliteSnapshot() {
68924
69540
  storedProviderCommands: {}
68925
69541
  };
68926
69542
  }
68927
- function loadSqlite4() {
69543
+ function loadSqlite5() {
68928
69544
  const originalEmitWarning = process.emitWarning;
68929
69545
  process.emitWarning = ((warning, ...args) => {
68930
69546
  const message = typeof warning === "string" ? warning : warning.message;
@@ -68962,13 +69578,13 @@ function unavailable(message) {
68962
69578
  // src/logs-export-provider.ts
68963
69579
  var import_node_child_process9 = require("node:child_process");
68964
69580
  var import_node_os12 = require("node:os");
68965
- var import_node_path31 = require("node:path");
69581
+ var import_node_path32 = require("node:path");
68966
69582
  var PROVIDERS2 = ["codex", "claude", "openclaw", "hermes"];
68967
69583
  function providerConfigCandidates(provider, taskHome2) {
68968
69584
  if (provider === "codex") {
68969
69585
  return [
68970
69586
  {
68971
- path: (0, import_node_path31.join)(process.env.CODEX_HOME ?? (0, import_node_path31.join)((0, import_node_os12.homedir)(), ".codex"), "config.toml"),
69587
+ path: (0, import_node_path32.join)(process.env.CODEX_HOME ?? (0, import_node_path32.join)((0, import_node_os12.homedir)(), ".codex"), "config.toml"),
68972
69588
  archiveName: "config.redacted.toml"
68973
69589
  }
68974
69590
  ];
@@ -68976,11 +69592,11 @@ function providerConfigCandidates(provider, taskHome2) {
68976
69592
  if (provider === "claude") {
68977
69593
  return [
68978
69594
  {
68979
- path: (0, import_node_path31.join)((0, import_node_os12.homedir)(), ".claude", "settings.json"),
69595
+ path: (0, import_node_path32.join)((0, import_node_os12.homedir)(), ".claude", "settings.json"),
68980
69596
  archiveName: "settings.redacted.json"
68981
69597
  },
68982
69598
  {
68983
- path: (0, import_node_path31.join)(process.cwd(), ".claude", "settings.json"),
69599
+ path: (0, import_node_path32.join)(process.cwd(), ".claude", "settings.json"),
68984
69600
  archiveName: "project-settings.redacted.json"
68985
69601
  }
68986
69602
  ];
@@ -68989,28 +69605,28 @@ function providerConfigCandidates(provider, taskHome2) {
68989
69605
  const openClawStateDir = resolveOpenClawStateDir();
68990
69606
  return [
68991
69607
  {
68992
- path: (0, import_node_path31.join)(openClawStateDir, "openclaw.json"),
69608
+ path: (0, import_node_path32.join)(openClawStateDir, "openclaw.json"),
68993
69609
  archiveName: "config.redacted.json"
68994
69610
  },
68995
69611
  {
68996
- path: (0, import_node_path31.join)(taskHome2, "xmtp", "openclaw-gateway.json"),
69612
+ path: (0, import_node_path32.join)(taskHome2, "xmtp", "openclaw-gateway.json"),
68997
69613
  archiveName: "gateway-config.redacted.json"
68998
69614
  }
68999
69615
  ];
69000
69616
  }
69001
69617
  return [
69002
69618
  {
69003
- path: (0, import_node_path31.join)(resolveHermesHome(), "config.yaml"),
69619
+ path: (0, import_node_path32.join)(resolveHermesHome(), "config.yaml"),
69004
69620
  archiveName: "config.redacted.yaml"
69005
69621
  }
69006
69622
  ];
69007
69623
  }
69008
69624
  function resolveOpenClawStateDir() {
69009
69625
  const configured = process.env.OPENCLAW_STATE_DIR?.trim() || process.env.OPENCLAW_HOME?.trim();
69010
- return (0, import_node_path31.resolve)(configured || (0, import_node_path31.join)((0, import_node_os12.homedir)(), ".openclaw"));
69626
+ return (0, import_node_path32.resolve)(configured || (0, import_node_path32.join)((0, import_node_os12.homedir)(), ".openclaw"));
69011
69627
  }
69012
69628
  function resolveHermesHome() {
69013
- return (0, import_node_path31.resolve)(process.env.HERMES_HOME?.trim() || (0, import_node_path31.join)((0, import_node_os12.homedir)(), ".hermes"));
69629
+ return (0, import_node_path32.resolve)(process.env.HERMES_HOME?.trim() || (0, import_node_path32.join)((0, import_node_os12.homedir)(), ".hermes"));
69014
69630
  }
69015
69631
  function providerEnvironment(provider) {
69016
69632
  const prefixes = provider === "codex" ? ["OKX_A2A_AI_CODEX_", "CODEX_"] : provider === "claude" ? ["OKX_A2A_AI_CLAUDE_", "ANTHROPIC_MODEL", "CLAUDE_"] : provider === "openclaw" ? ["OPENCLAW_", "OKX_A2A_OPENCLAW_"] : ["HERMES_", "OKX_A2A_HERMES_"];
@@ -69027,7 +69643,7 @@ function safeCommandLabel(command) {
69027
69643
  return "";
69028
69644
  }
69029
69645
  const executable = trimmed.match(/^"([^"]+)"/)?.[1] ?? trimmed.split(/\s+/, 1)[0];
69030
- return (0, import_node_path31.basename)(executable);
69646
+ return (0, import_node_path32.basename)(executable);
69031
69647
  }
69032
69648
  function resolveProvider(requested, binding, fallback = null) {
69033
69649
  if (requested !== "auto") {
@@ -69057,10 +69673,10 @@ function isProvider2(value) {
69057
69673
  }
69058
69674
 
69059
69675
  // src/logs-export-utils.ts
69060
- var import_node_crypto15 = require("node:crypto");
69676
+ var import_node_crypto16 = require("node:crypto");
69061
69677
  var import_node_fs26 = require("node:fs");
69062
69678
  var import_promises14 = require("node:fs/promises");
69063
- var import_node_path32 = require("node:path");
69679
+ var import_node_path33 = require("node:path");
69064
69680
  var MAX_JSON_FILE_BYTES = 20 * 1024 * 1024;
69065
69681
  var STRONG_CORRELATION_KEYS = /* @__PURE__ */ new Set([
69066
69682
  "approvalid",
@@ -69194,13 +69810,13 @@ async function readJsonObject(path2) {
69194
69810
  async function assertRegularFile2(path2) {
69195
69811
  const file = await (0, import_promises14.lstat)(path2);
69196
69812
  if (file.isSymbolicLink() || !file.isFile()) {
69197
- throw unavailable2(`Refusing non-regular diagnostic source: ${(0, import_node_path32.basename)(path2)}`);
69813
+ throw unavailable2(`Refusing non-regular diagnostic source: ${(0, import_node_path33.basename)(path2)}`);
69198
69814
  }
69199
69815
  return file;
69200
69816
  }
69201
69817
  async function inspectRegularFile(path2) {
69202
69818
  const file = await assertRegularFile2(path2);
69203
- const hash2 = (0, import_node_crypto15.createHash)("sha256");
69819
+ const hash2 = (0, import_node_crypto16.createHash)("sha256");
69204
69820
  for await (const chunk of (0, import_node_fs26.createReadStream)(path2)) {
69205
69821
  hash2.update(chunk);
69206
69822
  }
@@ -69352,7 +69968,7 @@ function parseLogsExportArgs(args, input = {}) {
69352
69968
  async function exportDiagnosticLogs(options) {
69353
69969
  validateOptions(options);
69354
69970
  const paths = diagnosticPaths(options.taskHome);
69355
- const cwd = (0, import_node_path33.resolve)(options.cwd ?? process.cwd());
69971
+ const cwd = (0, import_node_path34.resolve)(options.cwd ?? process.cwd());
69356
69972
  const now = options.now ?? /* @__PURE__ */ new Date();
69357
69973
  const outputPath = await resolveOutputPath(options.outputPath, {
69358
69974
  cwd,
@@ -69446,14 +70062,14 @@ async function exportDiagnosticLogs(options) {
69446
70062
  scope,
69447
70063
  jobId: options.jobId,
69448
70064
  taskHome: {
69449
- basename: (0, import_node_path33.basename)(paths.taskHome),
70065
+ basename: (0, import_node_path34.basename)(paths.taskHome),
69450
70066
  explicitlyConfigured: !!options.taskHome,
69451
70067
  absolutePathCollected: false
69452
70068
  },
69453
70069
  node: process.version,
69454
70070
  platform: process.platform,
69455
70071
  arch: process.arch,
69456
- packageVersion: true ? "0.2.7" : "unknown",
70072
+ packageVersion: true ? "0.2.8-beta-912b775358-260818171144" : "unknown",
69457
70073
  sensitiveContentIncluded: options.includeSensitiveContent,
69458
70074
  listenerAndLlmContentIncluded: true,
69459
70075
  credentialsAlwaysRedacted: true,
@@ -69536,7 +70152,7 @@ async function collectJobMetadata(state, paths, options) {
69536
70152
  correlationIds.strong.add(options.jobId);
69537
70153
  }
69538
70154
  for (const name of names.filter((item) => item.endsWith(".json")).sort()) {
69539
- const path2 = (0, import_node_path33.join)(paths.jobsDir, name);
70155
+ const path2 = (0, import_node_path34.join)(paths.jobsDir, name);
69540
70156
  let parsed;
69541
70157
  try {
69542
70158
  parsed = await readJsonObject(path2);
@@ -69607,7 +70223,7 @@ async function collectJobMetadata(state, paths, options) {
69607
70223
  }
69608
70224
  async function collectSessionSnapshot(state, paths, options, selectedJobIds) {
69609
70225
  return runCollector(state, "a2a-session-store", async () => {
69610
- const dbPath = (0, import_node_path33.join)(paths.sqliteDir, "session-store.sqlite");
70226
+ const dbPath = (0, import_node_path34.join)(paths.sqliteDir, "session-store.sqlite");
69611
70227
  const snapshot = readSessionSqliteSnapshot(dbPath, options, selectedJobIds);
69612
70228
  addJsonEntry(state, "a2a/sessions.json", {
69613
70229
  sessions: snapshot.sessions,
@@ -69639,7 +70255,7 @@ async function collectA2aLogs(state, paths, options, sessionKeys, correlationIds
69639
70255
  const filterNotes = [];
69640
70256
  for (const [sourcePath, archivePath] of [
69641
70257
  [paths.listenerLogPath, "a2a/listener.log"],
69642
- [(0, import_node_path33.join)(paths.logsDir, "llm.log"), "a2a/llm.log"]
70258
+ [(0, import_node_path34.join)(paths.logsDir, "llm.log"), "a2a/llm.log"]
69643
70259
  ]) {
69644
70260
  const output = await readFilteredLog(
69645
70261
  sourcePath,
@@ -69652,7 +70268,7 @@ async function collectA2aLogs(state, paths, options, sessionKeys, correlationIds
69652
70268
  if (!output?.text) {
69653
70269
  if (output?.excludedNoTimestamp) {
69654
70270
  filterNotes.push(
69655
- `${(0, import_node_path33.basename)(sourcePath)} excluded ${output.excludedNoTimestamp} timestamp-less records`
70271
+ `${(0, import_node_path34.basename)(sourcePath)} excluded ${output.excludedNoTimestamp} timestamp-less records`
69656
70272
  );
69657
70273
  }
69658
70274
  continue;
@@ -69661,11 +70277,11 @@ async function collectA2aLogs(state, paths, options, sessionKeys, correlationIds
69661
70277
  collected.push(archivePath);
69662
70278
  if (output.excludedNoTimestamp) {
69663
70279
  filterNotes.push(
69664
- `${(0, import_node_path33.basename)(sourcePath)} excluded ${output.excludedNoTimestamp} timestamp-less records`
70280
+ `${(0, import_node_path34.basename)(sourcePath)} excluded ${output.excludedNoTimestamp} timestamp-less records`
69665
70281
  );
69666
70282
  }
69667
70283
  if (output.truncated) {
69668
- filterNotes.push(`${(0, import_node_path33.basename)(sourcePath)} reached the configured size limit`);
70284
+ filterNotes.push(`${(0, import_node_path34.basename)(sourcePath)} reached the configured size limit`);
69669
70285
  }
69670
70286
  }
69671
70287
  for (const name of await safeReadDir(paths.logsDir)) {
@@ -69680,7 +70296,7 @@ async function collectA2aLogs(state, paths, options, sessionKeys, correlationIds
69680
70296
  if (!matchesDirectJob && !matchesPersistedSession && !matchesJobSessionFilename) {
69681
70297
  continue;
69682
70298
  }
69683
- const sourcePath = (0, import_node_path33.join)(paths.logsDir, name);
70299
+ const sourcePath = (0, import_node_path34.join)(paths.logsDir, name);
69684
70300
  let info;
69685
70301
  let filtered;
69686
70302
  try {
@@ -69753,7 +70369,7 @@ async function collectA2aLogs(state, paths, options, sessionKeys, correlationIds
69753
70369
  }
69754
70370
  async function collectCommands(state, paths, options) {
69755
70371
  return runCollector(state, "a2a-command-store", async () => {
69756
- const dbPath = (0, import_node_path33.join)(paths.sqliteDir, "command-store.sqlite");
70372
+ const dbPath = (0, import_node_path34.join)(paths.sqliteDir, "command-store.sqlite");
69757
70373
  const hasWindow = hasTimeWindow(options);
69758
70374
  const rows = readSqliteRows(dbPath, `
69759
70375
  SELECT id, type, status, command_json, result_json,
@@ -69794,8 +70410,8 @@ async function collectCommands(state, paths, options) {
69794
70410
  }
69795
70411
  async function collectOnchainAudit(state, options, correlationIds) {
69796
70412
  await runCollector(state, "onchainos-audit", async () => {
69797
- const onchainHome = process.env.ONCHAINOS_HOME?.trim() ? (0, import_node_path33.resolve)(process.env.ONCHAINOS_HOME) : (0, import_node_path33.join)((0, import_node_os13.homedir)(), ".onchainos");
69798
- const auditPath = (0, import_node_path33.join)(onchainHome, "audit.jsonl");
70413
+ const onchainHome = process.env.ONCHAINOS_HOME?.trim() ? (0, import_node_path34.resolve)(process.env.ONCHAINOS_HOME) : (0, import_node_path34.join)((0, import_node_os13.homedir)(), ".onchainos");
70414
+ const auditPath = (0, import_node_path34.join)(onchainHome, "audit.jsonl");
69799
70415
  const output = await readFilteredLog(
69800
70416
  auditPath,
69801
70417
  options,
@@ -69910,7 +70526,7 @@ async function collectOpenClawSessionStore(state, options) {
69910
70526
  const jobId = options.jobId;
69911
70527
  const filterLabel = jobId ? "exact-job" : "time-window";
69912
70528
  await runCollector(state, "openclaw-session-store", async () => {
69913
- const agentsDir = (0, import_node_path33.join)(resolveOpenClawStateDir(), "agents");
70529
+ const agentsDir = (0, import_node_path34.join)(resolveOpenClawStateDir(), "agents");
69914
70530
  const allAgentNames = (await safeReadDir(agentsDir)).sort();
69915
70531
  if (allAgentNames.length === 0) {
69916
70532
  throw unavailable2("No OpenClaw agent session stores were found");
@@ -69919,7 +70535,7 @@ async function collectOpenClawSessionStore(state, options) {
69919
70535
  let skippedSources = 0;
69920
70536
  let discoveryLimited = allAgentNames.length > MAX_OPENCLAW_AGENTS;
69921
70537
  for (const agentId of allAgentNames.slice(0, MAX_OPENCLAW_AGENTS)) {
69922
- const sessionsDir = (0, import_node_path33.join)(agentsDir, agentId, "sessions");
70538
+ const sessionsDir = (0, import_node_path34.join)(agentsDir, agentId, "sessions");
69923
70539
  try {
69924
70540
  const info = await (0, import_promises15.lstat)(sessionsDir);
69925
70541
  if (info.isSymbolicLink() || !info.isDirectory()) {
@@ -69935,7 +70551,7 @@ async function collectOpenClawSessionStore(state, options) {
69935
70551
  try {
69936
70552
  for (const name of await safeReadDir(sessionsDir)) {
69937
70553
  if (isOpenClawSessionLogName(name)) {
69938
- candidates.push({ agentId, path: (0, import_node_path33.join)(sessionsDir, name) });
70554
+ candidates.push({ agentId, path: (0, import_node_path34.join)(sessionsDir, name) });
69939
70555
  }
69940
70556
  }
69941
70557
  } catch {
@@ -69973,7 +70589,7 @@ async function collectOpenClawSessionStore(state, options) {
69973
70589
  if (!output?.text || output.matchedRecords === 0) {
69974
70590
  continue;
69975
70591
  }
69976
- const archivePath = `providers/openclaw/sessions/${safeArchiveName(candidate.agentId)}/${safeArchiveName((0, import_node_path33.basename)(candidate.path))}`;
70592
+ const archivePath = `providers/openclaw/sessions/${safeArchiveName(candidate.agentId)}/${safeArchiveName((0, import_node_path34.basename)(candidate.path))}`;
69977
70593
  addTextEntry(state, archivePath, output.text);
69978
70594
  files.push(archivePath);
69979
70595
  matchedRecords += output.matchedRecords;
@@ -70022,11 +70638,11 @@ async function collectGatewayLogs(state, provider, paths, options, correlationId
70022
70638
  let candidates;
70023
70639
  if (provider === "openclaw") {
70024
70640
  candidates = [
70025
- (0, import_node_path33.join)(paths.logsDir, "gateway-openclaw.jsonl"),
70026
- (0, import_node_path33.join)(resolveOpenClawStateDir(), "logs", "gateway.log")
70641
+ (0, import_node_path34.join)(paths.logsDir, "gateway-openclaw.jsonl"),
70642
+ (0, import_node_path34.join)(resolveOpenClawStateDir(), "logs", "gateway.log")
70027
70643
  ];
70028
70644
  } else {
70029
- const hermesLogsDir = (0, import_node_path33.join)(resolveHermesHome(), "logs");
70645
+ const hermesLogsDir = (0, import_node_path34.join)(resolveHermesHome(), "logs");
70030
70646
  let rotatedNames = [];
70031
70647
  try {
70032
70648
  rotatedNames = (await safeReadDir(hermesLogsDir)).filter(isHermesRotatedLogName).sort();
@@ -70040,12 +70656,12 @@ async function collectGatewayLogs(state, provider, paths, options, correlationId
70040
70656
  rotatedNames.length = MAX_HERMES_ROTATED_LOG_FILES;
70041
70657
  }
70042
70658
  candidates = [
70043
- (0, import_node_path33.join)(paths.logsDir, "gateway-hermes.jsonl"),
70044
- (0, import_node_path33.join)(hermesLogsDir, "agent.log"),
70045
- (0, import_node_path33.join)(hermesLogsDir, "gateway.log"),
70046
- (0, import_node_path33.join)(hermesLogsDir, "error.log"),
70047
- (0, import_node_path33.join)(hermesLogsDir, "errors.log"),
70048
- ...rotatedNames.map((name) => (0, import_node_path33.join)(hermesLogsDir, name)),
70659
+ (0, import_node_path34.join)(paths.logsDir, "gateway-hermes.jsonl"),
70660
+ (0, import_node_path34.join)(hermesLogsDir, "agent.log"),
70661
+ (0, import_node_path34.join)(hermesLogsDir, "gateway.log"),
70662
+ (0, import_node_path34.join)(hermesLogsDir, "error.log"),
70663
+ (0, import_node_path34.join)(hermesLogsDir, "errors.log"),
70664
+ ...rotatedNames.map((name) => (0, import_node_path34.join)(hermesLogsDir, name)),
70049
70665
  "/tmp/hermes-gateway.log"
70050
70666
  ];
70051
70667
  }
@@ -70067,7 +70683,7 @@ async function collectGatewayLogs(state, provider, paths, options, correlationId
70067
70683
  if (!output?.text) {
70068
70684
  continue;
70069
70685
  }
70070
- const archivePath = `providers/${provider}/gateway/${safeArchiveName((0, import_node_path33.basename)(candidate))}`;
70686
+ const archivePath = `providers/${provider}/gateway/${safeArchiveName((0, import_node_path34.basename)(candidate))}`;
70071
70687
  addTextEntry(state, archivePath, output.text);
70072
70688
  files.push(archivePath);
70073
70689
  }
@@ -70240,13 +70856,13 @@ function formatEvidence(value, unavailableReason) {
70240
70856
  return unavailableReason ? `unknown (${unavailableReason})` : "unknown";
70241
70857
  }
70242
70858
  function diagnosticPaths(taskHome2) {
70243
- const home = (0, import_node_path33.resolve)(taskHome2 ?? resolveTaskHome());
70859
+ const home = (0, import_node_path34.resolve)(taskHome2 ?? resolveTaskHome());
70244
70860
  return {
70245
70861
  taskHome: home,
70246
- jobsDir: (0, import_node_path33.join)(home, "jobs"),
70247
- logsDir: (0, import_node_path33.join)(home, "logs"),
70248
- sqliteDir: (0, import_node_path33.join)(home, "sqlite"),
70249
- listenerLogPath: (0, import_node_path33.join)(home, "logs", "listener.log")
70862
+ jobsDir: (0, import_node_path34.join)(home, "jobs"),
70863
+ logsDir: (0, import_node_path34.join)(home, "logs"),
70864
+ sqliteDir: (0, import_node_path34.join)(home, "sqlite"),
70865
+ listenerLogPath: (0, import_node_path34.join)(home, "logs", "listener.log")
70250
70866
  };
70251
70867
  }
70252
70868
  function validateOptions(options) {
@@ -70317,7 +70933,7 @@ init_ai_provider();
70317
70933
  init_update_cli();
70318
70934
 
70319
70935
  // src/doctor-cli.ts
70320
- var import_node_path34 = require("node:path");
70936
+ var import_node_path35 = require("node:path");
70321
70937
  init_log();
70322
70938
  init_win_compat();
70323
70939
  init_ai_command();
@@ -70691,7 +71307,7 @@ var windowsNativeLauncherChecker = {
70691
71307
  command: "okx-a2a doctor --fix"
70692
71308
  },
70693
71309
  data: {
70694
- appDataNpm: ctx.env.APPDATA ? (0, import_node_path34.join)(ctx.env.APPDATA, "npm") : null
71310
+ appDataNpm: ctx.env.APPDATA ? (0, import_node_path35.join)(ctx.env.APPDATA, "npm") : null
70695
71311
  }
70696
71312
  };
70697
71313
  },
@@ -71316,7 +71932,7 @@ async function runDoctor(options = {}) {
71316
71932
  platform: options.platform ?? process.platform,
71317
71933
  env: options.env ?? process.env,
71318
71934
  target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
71319
- cliVersion: options.cliVersion ?? (true ? "0.2.7" : "0.0.0"),
71935
+ cliVersion: options.cliVersion ?? (true ? "0.2.8-beta-912b775358-260818171144" : "0.0.0"),
71320
71936
  fixMode: options.fix === true,
71321
71937
  nonInteractive: options.nonInteractive === true,
71322
71938
  packageChanged: false,
@@ -71535,6 +72151,9 @@ async function writeStdoutAndExit(output, code) {
71535
72151
  init_doctor_sentry();
71536
72152
  init_win_native_launcher();
71537
72153
  init_autostart_windows();
72154
+
72155
+ // src/wakeup-notify-types.ts
72156
+ var WAKEUP_PAGE_SIZE = 50;
71538
72157
  // Annotate the CommonJS export names for ESM import in node:
71539
72158
  0 && (module.exports = {
71540
72159
  AGENT_GET_PAGE_TIMEOUT_MS,
@@ -71554,6 +72173,7 @@ init_autostart_windows();
71554
72173
  CODEX_RECOVERY_ACTIONS,
71555
72174
  CommandStore,
71556
72175
  DEFAULT_AI_PERMISSION_PRESET,
72176
+ DEFAULT_MAX_ACTIVE_AI_EXECUTIONS,
71557
72177
  DEFAULT_OFFLINE_REPLAY_INTERVAL_SEC,
71558
72178
  DEFAULT_XMTP_CLIENT_RECYCLE_INTERVAL_SEC,
71559
72179
  DOCTOR_MIN_NODE_VERSION,
@@ -71582,7 +72202,9 @@ init_autostart_windows();
71582
72202
  USER_ATTENTION_WATCH_PARENT_CHECK_MS,
71583
72203
  USER_ATTENTION_WATCH_REPLACED_MESSAGE,
71584
72204
  UserCancelledAiProviderSelectionError,
72205
+ WAKEUP_PAGE_SIZE,
71585
72206
  WALLET_STATUS_TIMEOUT_MS,
72207
+ WakeupDedupeStore,
71586
72208
  XMTP_CLIENT_RECYCLE_INTERVAL_ENV,
71587
72209
  XmtpDm,
71588
72210
  XmtpGroup,
@@ -71646,9 +72268,11 @@ init_autostart_windows();
71646
72268
  commandExists,
71647
72269
  createAiToolFailureTracker,
71648
72270
  createFileMessageHandler,
72271
+ createOnchainosWakeupFetchPage,
71649
72272
  createOutboundBehavior,
71650
72273
  createUserAttentionWatchParentMonitor,
71651
72274
  currentOpenClawGatewaySessionKey,
72275
+ deriveWakeupDedupeKey,
71652
72276
  detectAiProviders,
71653
72277
  detectCurrentAiProvider,
71654
72278
  detectGatewayInvocation,
@@ -71663,7 +72287,9 @@ init_autostart_windows();
71663
72287
  exportDiagnosticLogs,
71664
72288
  extractAiSessionId,
71665
72289
  extractDirectToUserNotification,
72290
+ extractSystemNotification,
71666
72291
  extractXmtpSentAtMs,
72292
+ fetchAllWakeupNotifications,
71667
72293
  findWindowsNativeOkxA2aExe,
71668
72294
  followFile,
71669
72295
  formatDoctorReportForHumans,
@@ -71680,6 +72306,7 @@ init_autostart_windows();
71680
72306
  hashDiagnosticFileContent,
71681
72307
  heartbeatUserAttentionWatcher,
71682
72308
  hermesConfigEnablesOkxA2a,
72309
+ ingestWakeupNotification,
71683
72310
  installWindowsNativeLauncher,
71684
72311
  installedAutostartHasCurrentConfiguration,
71685
72312
  installedAutostartHasCurrentRestartPolicy,
@@ -71694,12 +72321,14 @@ init_autostart_windows();
71694
72321
  isPrereleaseVersion,
71695
72322
  isRetryableOpenClawGatewayError,
71696
72323
  isSqliteBusyError,
72324
+ isValidWakeupItem,
71697
72325
  isWindowsElevated,
71698
72326
  killProcessTree,
71699
72327
  launchdPlistHasCurrentRestartPolicy,
71700
72328
  listAllAgentsWithMetadata,
71701
72329
  logWinCompat,
71702
72330
  logXmtpMessageSent,
72331
+ mapCliStdoutToWakeupResponse,
71703
72332
  maybeRecommendOnchainosUpgrade,
71704
72333
  mergeA2AEnvelopeTips,
71705
72334
  messageEligibleHelpAdvertisesOfflineReplay,
@@ -71750,6 +72379,7 @@ init_autostart_windows();
71750
72379
  resolveDirectCommunicationSessionTarget,
71751
72380
  resolveDoctorTarget,
71752
72381
  resolveEnvelopePayload,
72382
+ resolveMaxActiveAiExecutions,
71753
72383
  resolveNpmCmdShimScript,
71754
72384
  resolveOfflineReplayCapabilityMarker,
71755
72385
  resolveOfflineReplayIntervalSec,
@@ -71779,6 +72409,7 @@ init_autostart_windows();
71779
72409
  startDaemonRespectingSupervisor,
71780
72410
  startUserAttentionEventServer,
71781
72411
  startUserAttentionWatcherCoordinator,
72412
+ startWakeupNotifyRecovery,
71782
72413
  stopDaemon,
71783
72414
  stopOpenClawGateway,
71784
72415
  subscribeUserAttentionEvents,