@okxweb3/a2a-node 0.2.9 → 0.2.10-beta-98689bff7a-260826143751

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 (4) hide show
  1. package/README.md +26 -0
  2. package/dist/cli.js +1246 -262
  3. package/dist/index.js +1042 -211
  4. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3992,7 +3992,7 @@ var require_is = __commonJS({
3992
3992
  function isPrimitive(wat) {
3993
3993
  return wat === null || typeof wat !== "object" && typeof wat !== "function";
3994
3994
  }
3995
- function isPlainObject4(wat) {
3995
+ function isPlainObject6(wat) {
3996
3996
  return isBuiltin(wat, "Object");
3997
3997
  }
3998
3998
  function isEvent(wat) {
@@ -4008,7 +4008,7 @@ var require_is = __commonJS({
4008
4008
  return Boolean(wat && wat.then && typeof wat.then === "function");
4009
4009
  }
4010
4010
  function isSyntheticEvent(wat) {
4011
- return isPlainObject4(wat) && "nativeEvent" in wat && "preventDefault" in wat && "stopPropagation" in wat;
4011
+ return isPlainObject6(wat) && "nativeEvent" in wat && "preventDefault" in wat && "stopPropagation" in wat;
4012
4012
  }
4013
4013
  function isNaN2(wat) {
4014
4014
  return typeof wat === "number" && wat !== wat;
@@ -4031,7 +4031,7 @@ var require_is = __commonJS({
4031
4031
  exports2.isEvent = isEvent;
4032
4032
  exports2.isInstanceOf = isInstanceOf;
4033
4033
  exports2.isNaN = isNaN2;
4034
- exports2.isPlainObject = isPlainObject4;
4034
+ exports2.isPlainObject = isPlainObject6;
4035
4035
  exports2.isPrimitive = isPrimitive;
4036
4036
  exports2.isRegExp = isRegExp;
4037
4037
  exports2.isString = isString;
@@ -5839,7 +5839,7 @@ var require_path = __commonJS({
5839
5839
  function isAbsolute4(path2) {
5840
5840
  return path2.charAt(0) === "/";
5841
5841
  }
5842
- function join31(...args) {
5842
+ function join33(...args) {
5843
5843
  return normalizePath(args.join("/"));
5844
5844
  }
5845
5845
  function dirname10(path2) {
@@ -5864,7 +5864,7 @@ var require_path = __commonJS({
5864
5864
  exports2.basename = basename8;
5865
5865
  exports2.dirname = dirname10;
5866
5866
  exports2.isAbsolute = isAbsolute4;
5867
- exports2.join = join31;
5867
+ exports2.join = join33;
5868
5868
  exports2.normalizePath = normalizePath;
5869
5869
  exports2.relative = relative;
5870
5870
  exports2.resolve = resolve11;
@@ -15098,7 +15098,7 @@ var require_promisify = __commonJS({
15098
15098
  "../../node_modules/agent-base/dist/src/promisify.js"(exports2) {
15099
15099
  "use strict";
15100
15100
  Object.defineProperty(exports2, "__esModule", { value: true });
15101
- function promisify3(fn) {
15101
+ function promisify4(fn) {
15102
15102
  return function(req, opts) {
15103
15103
  return new Promise((resolve11, reject) => {
15104
15104
  fn.call(this, req, opts, (err, rtn) => {
@@ -15111,7 +15111,7 @@ var require_promisify = __commonJS({
15111
15111
  });
15112
15112
  };
15113
15113
  }
15114
- exports2.default = promisify3;
15114
+ exports2.default = promisify4;
15115
15115
  }
15116
15116
  });
15117
15117
 
@@ -30987,7 +30987,7 @@ var require_websocket2 = __commonJS({
30987
30987
  var http2 = require("http");
30988
30988
  var net = require("net");
30989
30989
  var tls = require("tls");
30990
- var { randomBytes: randomBytes3, createHash: createHash6 } = require("crypto");
30990
+ var { randomBytes: randomBytes3, createHash: createHash7 } = require("crypto");
30991
30991
  var { Duplex, Readable } = require("stream");
30992
30992
  var { URL: URL2 } = require("url");
30993
30993
  var PerMessageDeflate = require_permessage_deflate();
@@ -31647,7 +31647,7 @@ var require_websocket2 = __commonJS({
31647
31647
  abortHandshake(websocket, socket, "Invalid Upgrade header");
31648
31648
  return;
31649
31649
  }
31650
- const digest = createHash6("sha1").update(key + GUID).digest("base64");
31650
+ const digest = createHash7("sha1").update(key + GUID).digest("base64");
31651
31651
  if (res.headers["sec-websocket-accept"] !== digest) {
31652
31652
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
31653
31653
  return;
@@ -32014,7 +32014,7 @@ var require_websocket_server = __commonJS({
32014
32014
  var EventEmitter2 = require("events");
32015
32015
  var http2 = require("http");
32016
32016
  var { Duplex } = require("stream");
32017
- var { createHash: createHash6 } = require("crypto");
32017
+ var { createHash: createHash7 } = require("crypto");
32018
32018
  var extension = require_extension();
32019
32019
  var PerMessageDeflate = require_permessage_deflate();
32020
32020
  var subprotocol = require_subprotocol();
@@ -32315,7 +32315,7 @@ var require_websocket_server = __commonJS({
32315
32315
  );
32316
32316
  }
32317
32317
  if (this._state > RUNNING) return abortHandshake(socket, 503);
32318
- const digest = createHash6("sha1").update(key + GUID).digest("base64");
32318
+ const digest = createHash7("sha1").update(key + GUID).digest("base64");
32319
32319
  const headers = [
32320
32320
  "HTTP/1.1 101 Switching Protocols",
32321
32321
  "Upgrade: websocket",
@@ -32437,7 +32437,7 @@ var init_sentry_config = __esm({
32437
32437
  environment = process.env.SENTRY_ENV === "dev" ? "dev" : "prod";
32438
32438
  SENTRY_CONFIG = {
32439
32439
  projectName: "okx/openclaw-okx-a2a-extension",
32440
- release: "0.2.9",
32440
+ release: "0.2.10-beta-98689bff7a-260826143751",
32441
32441
  environment,
32442
32442
  runtimeContainer: normalizeRuntimeContainer(process.env.OKX_A2A_RUNTIME_CONTAINER)
32443
32443
  };
@@ -32471,7 +32471,7 @@ function isPostjectRunnable() {
32471
32471
  function resolvePostjectCommand() {
32472
32472
  try {
32473
32473
  const cliPath = (0, import_node_module.createRequire)(__filename).resolve("postject/dist/cli.js");
32474
- if ((0, import_node_fs21.existsSync)(cliPath)) {
32474
+ if ((0, import_node_fs23.existsSync)(cliPath)) {
32475
32475
  return { command: process.execPath, prefixArgs: [cliPath] };
32476
32476
  }
32477
32477
  } catch {
@@ -32542,37 +32542,37 @@ function buildSeaConfig(entryPath, blobPath) {
32542
32542
  }
32543
32543
  async function installWindowsNativeLauncher(options) {
32544
32544
  const nodeExe = options.nodeExe ?? process.execPath;
32545
- if (!(0, import_node_fs21.existsSync)(options.cliPath)) {
32545
+ if (!(0, import_node_fs23.existsSync)(options.cliPath)) {
32546
32546
  throw new Error(`cannot build okx-a2a.exe: CLI entry not found at ${options.cliPath}`);
32547
32547
  }
32548
- if (!(0, import_node_fs21.existsSync)(nodeExe)) {
32548
+ if (!(0, import_node_fs23.existsSync)(nodeExe)) {
32549
32549
  throw new Error(`cannot build okx-a2a.exe: node executable not found at ${nodeExe}`);
32550
32550
  }
32551
- const exePath = (0, import_node_path27.join)(options.targetDir, NATIVE_LAUNCHER_EXE_NAME);
32552
- (0, import_node_fs21.mkdirSync)(options.targetDir, { recursive: true });
32553
- const work = (0, import_node_fs21.mkdtempSync)((0, import_node_path27.join)((0, import_node_os10.tmpdir)(), "okx-a2a-sea-"));
32551
+ const exePath = (0, import_node_path29.join)(options.targetDir, NATIVE_LAUNCHER_EXE_NAME);
32552
+ (0, import_node_fs23.mkdirSync)(options.targetDir, { recursive: true });
32553
+ const work = (0, import_node_fs23.mkdtempSync)((0, import_node_path29.join)((0, import_node_os10.tmpdir)(), "okx-a2a-sea-"));
32554
32554
  try {
32555
- const entryPath = (0, import_node_path27.join)(work, "launcher-entry.js");
32556
- const blobPath = (0, import_node_path27.join)(work, "okx-a2a.blob");
32557
- const configPath = (0, import_node_path27.join)(work, "sea-config.json");
32558
- (0, import_node_fs21.writeFileSync)(entryPath, buildLauncherEntryJs(options.cliPath), "utf8");
32559
- (0, import_node_fs21.writeFileSync)(configPath, buildSeaConfig(entryPath, blobPath), "utf8");
32560
- (0, import_node_child_process7.execFileSync)(nodeExe, ["--experimental-sea-config", configPath], {
32555
+ const entryPath = (0, import_node_path29.join)(work, "launcher-entry.js");
32556
+ const blobPath = (0, import_node_path29.join)(work, "okx-a2a.blob");
32557
+ const configPath = (0, import_node_path29.join)(work, "sea-config.json");
32558
+ (0, import_node_fs23.writeFileSync)(entryPath, buildLauncherEntryJs(options.cliPath), "utf8");
32559
+ (0, import_node_fs23.writeFileSync)(configPath, buildSeaConfig(entryPath, blobPath), "utf8");
32560
+ (0, import_node_child_process8.execFileSync)(nodeExe, ["--experimental-sea-config", configPath], {
32561
32561
  stdio: "ignore",
32562
32562
  windowsHide: true
32563
32563
  });
32564
- (0, import_node_fs21.copyFileSync)(nodeExe, exePath);
32564
+ (0, import_node_fs23.copyFileSync)(nodeExe, exePath);
32565
32565
  const isMac = process.platform === "darwin";
32566
32566
  if (isMac) {
32567
32567
  try {
32568
- (0, import_node_child_process7.execFileSync)("codesign", ["--remove-signature", exePath], { stdio: "ignore" });
32568
+ (0, import_node_child_process8.execFileSync)("codesign", ["--remove-signature", exePath], { stdio: "ignore" });
32569
32569
  } catch {
32570
32570
  }
32571
32571
  }
32572
32572
  injectSeaBlob(exePath, blobPath, isMac);
32573
32573
  if (isMac) {
32574
32574
  try {
32575
- (0, import_node_child_process7.execFileSync)("codesign", ["--sign", "-", exePath], { stdio: "ignore" });
32575
+ (0, import_node_child_process8.execFileSync)("codesign", ["--sign", "-", exePath], { stdio: "ignore" });
32576
32576
  } catch {
32577
32577
  }
32578
32578
  }
@@ -32581,19 +32581,19 @@ async function installWindowsNativeLauncher(options) {
32581
32581
  );
32582
32582
  return { exePath, cliPath: options.cliPath, nodeExe };
32583
32583
  } finally {
32584
- (0, import_node_fs21.rmSync)(work, { recursive: true, force: true });
32584
+ (0, import_node_fs23.rmSync)(work, { recursive: true, force: true });
32585
32585
  }
32586
32586
  }
32587
- function findWindowsNativeOkxA2aExe(pathValue, appData, userProfile, fileExists2 = import_node_fs21.existsSync) {
32587
+ function findWindowsNativeOkxA2aExe(pathValue, appData, userProfile, fileExists2 = import_node_fs23.existsSync) {
32588
32588
  const dirs = pathValue.split(";").map((d) => d.trim()).filter(Boolean);
32589
32589
  if (appData) {
32590
- dirs.push((0, import_node_path27.join)(appData, "npm"));
32590
+ dirs.push((0, import_node_path29.join)(appData, "npm"));
32591
32591
  }
32592
32592
  if (userProfile) {
32593
- dirs.push((0, import_node_path27.join)(userProfile, ".local", "bin"));
32593
+ dirs.push((0, import_node_path29.join)(userProfile, ".local", "bin"));
32594
32594
  }
32595
32595
  for (const dir of dirs) {
32596
- const candidate = (0, import_node_path27.join)(dir, NATIVE_LAUNCHER_EXE_NAME);
32596
+ const candidate = (0, import_node_path29.join)(dir, NATIVE_LAUNCHER_EXE_NAME);
32597
32597
  if (fileExists2(candidate)) {
32598
32598
  return candidate;
32599
32599
  }
@@ -32602,11 +32602,11 @@ function findWindowsNativeOkxA2aExe(pathValue, appData, userProfile, fileExists2
32602
32602
  }
32603
32603
  function resolveRunningCliPath() {
32604
32604
  const fromArgv = process.argv[1];
32605
- if (fromArgv && /(?:^|[\\/])cli\.js$/.test(fromArgv) && (0, import_node_fs21.existsSync)(fromArgv)) {
32605
+ if (fromArgv && /(?:^|[\\/])cli\.js$/.test(fromArgv) && (0, import_node_fs23.existsSync)(fromArgv)) {
32606
32606
  return fromArgv;
32607
32607
  }
32608
- const beside = (0, import_node_path27.join)(__dirname, "cli.js");
32609
- if ((0, import_node_fs21.existsSync)(beside)) {
32608
+ const beside = (0, import_node_path29.join)(__dirname, "cli.js");
32609
+ if ((0, import_node_fs23.existsSync)(beside)) {
32610
32610
  return beside;
32611
32611
  }
32612
32612
  if (fromArgv) {
@@ -32624,19 +32624,19 @@ async function ensureWindowsNativeLauncher(options = {}) {
32624
32624
  if (existing) {
32625
32625
  return { exePath: existing, installed: false };
32626
32626
  }
32627
- 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");
32627
+ const targetDir = env.APPDATA ? (0, import_node_path29.join)(env.APPDATA, "npm") : (0, import_node_path29.join)(env.USERPROFILE ?? (0, import_node_os10.homedir)(), ".local", "bin");
32628
32628
  const result = await installWindowsNativeLauncher({ cliPath: resolveRunningCliPath(), targetDir });
32629
32629
  return { exePath: result.exePath, installed: true };
32630
32630
  }
32631
- 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;
32631
+ var import_node_child_process8, import_node_fs23, import_node_module, import_node_os10, import_node_path29, SEA_SENTINEL_FUSE, NATIVE_LAUNCHER_EXE_NAME, POSTJECT_SPEC, POSTJECT_BIN;
32632
32632
  var init_win_native_launcher = __esm({
32633
32633
  "src/win-native-launcher.ts"() {
32634
32634
  "use strict";
32635
- import_node_child_process7 = require("node:child_process");
32636
- import_node_fs21 = require("node:fs");
32635
+ import_node_child_process8 = require("node:child_process");
32636
+ import_node_fs23 = require("node:fs");
32637
32637
  import_node_module = require("node:module");
32638
32638
  import_node_os10 = require("node:os");
32639
- import_node_path27 = require("node:path");
32639
+ import_node_path29 = require("node:path");
32640
32640
  init_win_compat();
32641
32641
  init_win_spawn();
32642
32642
  SEA_SENTINEL_FUSE = "NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2";
@@ -33378,7 +33378,7 @@ async function getCurrentNodeCliVersion() {
33378
33378
  return await getGlobalNpmPackageVersion(UPDATE_PACKAGES.node) ?? getBundledNodeCliVersion();
33379
33379
  }
33380
33380
  function getBundledNodeCliVersion() {
33381
- return true ? "0.2.9" : null;
33381
+ return true ? "0.2.10-beta-98689bff7a-260826143751" : null;
33382
33382
  }
33383
33383
  function readConfiguredAiProvider() {
33384
33384
  const explicit = process.env.OKX_A2A_AI_PROVIDER || process.env.OKX_AGENT_TASK_AI_CLI;
@@ -33563,17 +33563,17 @@ async function updateHermes(release, options) {
33563
33563
  assertNotRunningInsideGateway("hermes");
33564
33564
  }
33565
33565
  const spec = buildNpmPackageSpec("hermes", release);
33566
- const workDir = await (0, import_promises11.mkdtemp)((0, import_node_path28.join)((0, import_node_os11.tmpdir)(), `okx-a2a-${label}-hermes-`));
33566
+ const workDir = await (0, import_promises11.mkdtemp)((0, import_node_path30.join)((0, import_node_os11.tmpdir)(), `okx-a2a-${label}-hermes-`));
33567
33567
  try {
33568
33568
  console.log(`[${label}] downloading ${spec}`);
33569
33569
  const npmTarball = await npmPack(spec, workDir);
33570
- const npmPackageDir = (0, import_node_path28.join)(workDir, "npm-package");
33570
+ const npmPackageDir = (0, import_node_path30.join)(workDir, "npm-package");
33571
33571
  await runCommand("tar", ["-xzf", npmTarball, "-C", npmPackageDir], { ensureDir: npmPackageDir });
33572
- const pluginTarball = await findHermesPluginTarball((0, import_node_path28.join)(npmPackageDir, "package", "dist"));
33573
- const pluginDir = (0, import_node_path28.join)(workDir, "plugin");
33572
+ const pluginTarball = await findHermesPluginTarball((0, import_node_path30.join)(npmPackageDir, "package", "dist"));
33573
+ const pluginDir = (0, import_node_path30.join)(workDir, "plugin");
33574
33574
  await runCommand("tar", ["-xzf", pluginTarball, "-C", pluginDir], { ensureDir: pluginDir });
33575
33575
  const unpackedPluginDir = await findFirstDirectory(pluginDir);
33576
- const installer = (0, import_node_path28.join)(unpackedPluginDir, "scripts", "install-or-upgrade.sh");
33576
+ const installer = (0, import_node_path30.join)(unpackedPluginDir, "scripts", "install-or-upgrade.sh");
33577
33577
  console.log(`[${label}] running ${installer}`);
33578
33578
  await runCommand("bash", [installer, ...options.restart ? ["--restart"] : []], { cwd: unpackedPluginDir });
33579
33579
  await normalizeHermesOkxA2aPluginConfig();
@@ -33588,7 +33588,7 @@ async function updateHermes(release, options) {
33588
33588
  }
33589
33589
  }
33590
33590
  async function installGatewayPluginForDoctor(target) {
33591
- const release = isPrereleaseVersion("0.2.9") ? "beta" : "latest";
33591
+ const release = isPrereleaseVersion("0.2.10-beta-98689bff7a-260826143751") ? "beta" : "latest";
33592
33592
  const insideTargetGateway = detectGatewayInvocation() === target;
33593
33593
  const options = {
33594
33594
  restart: !insideTargetGateway,
@@ -33639,7 +33639,7 @@ async function ensureHermesOkxA2aPluginConfig(configFile = resolveHermesConfigPa
33639
33639
  if (options.dryRun) {
33640
33640
  return true;
33641
33641
  }
33642
- await (0, import_promises11.mkdir)((0, import_node_path28.resolve)(configFile, ".."), { recursive: true });
33642
+ await (0, import_promises11.mkdir)((0, import_node_path30.resolve)(configFile, ".."), { recursive: true });
33643
33643
  await (0, import_promises11.writeFile)(configFile, "plugins:\n enabled:\n - okx-a2a\n");
33644
33644
  console.log(`[update] added Hermes plugins.enabled okx-a2a entry in ${configFile}`);
33645
33645
  return true;
@@ -33879,7 +33879,7 @@ function findFirstEnabledListItem(lines, startIndex, enabledIndent) {
33879
33879
  return null;
33880
33880
  }
33881
33881
  function resolveHermesConfigPath() {
33882
- return (0, import_node_path28.join)(process.env.HERMES_HOME ?? (0, import_node_path28.join)((0, import_node_os11.homedir)(), ".hermes"), "config.yaml");
33882
+ return (0, import_node_path30.join)(process.env.HERMES_HOME ?? (0, import_node_path30.join)((0, import_node_os11.homedir)(), ".hermes"), "config.yaml");
33883
33883
  }
33884
33884
  function lineIndent(line) {
33885
33885
  const match = line.match(/^\s*/);
@@ -33957,13 +33957,13 @@ async function assertGatewayPluginInstalled(target) {
33957
33957
  );
33958
33958
  }
33959
33959
  function resolveHermesPluginYamlPath() {
33960
- 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");
33960
+ return (0, import_node_path30.join)(process.env.HERMES_HOME ?? (0, import_node_path30.join)((0, import_node_os11.homedir)(), ".hermes"), "plugins", "platforms", "okx-a2a", "plugin.yaml");
33961
33961
  }
33962
33962
  async function isGatewayPluginInstalled(target) {
33963
33963
  if (target === "openclaw") {
33964
33964
  return (await getInstalledOpenClawPluginInfo()).installed;
33965
33965
  }
33966
- return (0, import_node_fs22.existsSync)(resolveHermesPluginYamlPath());
33966
+ return (0, import_node_fs24.existsSync)(resolveHermesPluginYamlPath());
33967
33967
  }
33968
33968
  async function getInstalledGatewayPluginVersion(target) {
33969
33969
  if (target === "hermes") {
@@ -34050,7 +34050,7 @@ function parsePackageVersionFromText(output) {
34050
34050
  return output.match(/@okxweb3\/a2a-openclaw@([0-9A-Za-z.+-]+)/)?.[1] ?? null;
34051
34051
  }
34052
34052
  async function getInstalledHermesPluginVersion() {
34053
- 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");
34053
+ const pluginYaml = (0, import_node_path30.join)(process.env.HERMES_HOME ?? (0, import_node_path30.join)((0, import_node_os11.homedir)(), ".hermes"), "plugins", "platforms", "okx-a2a", "plugin.yaml");
34054
34054
  try {
34055
34055
  const content = await (0, import_promises11.readFile)(pluginYaml, "utf8");
34056
34056
  return parsePluginYamlVersion(content);
@@ -34108,7 +34108,7 @@ async function npmPack(spec, destination) {
34108
34108
  if (!tarballName) {
34109
34109
  throw new Error(`Unable to detect npm pack tarball from output: ${output.trim()}`);
34110
34110
  }
34111
- return (0, import_node_path28.resolve)(destination, (0, import_node_path28.basename)(tarballName));
34111
+ return (0, import_node_path30.resolve)(destination, (0, import_node_path30.basename)(tarballName));
34112
34112
  }
34113
34113
  async function findHermesPluginTarball(distDir) {
34114
34114
  const entries = await (0, import_promises11.readdir)(distDir);
@@ -34116,7 +34116,7 @@ async function findHermesPluginTarball(distDir) {
34116
34116
  if (!tarball) {
34117
34117
  throw new Error(`Hermes npm package did not contain dist/okx-a2a-hermes-plugin-*.tar.gz`);
34118
34118
  }
34119
- return (0, import_node_path28.join)(distDir, tarball);
34119
+ return (0, import_node_path30.join)(distDir, tarball);
34120
34120
  }
34121
34121
  async function findFirstDirectory(parent) {
34122
34122
  const entries = await (0, import_promises11.readdir)(parent, { withFileTypes: true });
@@ -34124,7 +34124,7 @@ async function findFirstDirectory(parent) {
34124
34124
  if (!dir) {
34125
34125
  throw new Error(`No unpacked plugin directory found under ${parent}`);
34126
34126
  }
34127
- return (0, import_node_path28.join)(parent, dir.name);
34127
+ return (0, import_node_path30.join)(parent, dir.name);
34128
34128
  }
34129
34129
  function readOption2(args, name) {
34130
34130
  const index2 = args.indexOf(name);
@@ -34175,7 +34175,7 @@ async function runCommand(command, args, options = {}) {
34175
34175
  await new Promise((resolvePromise, reject) => {
34176
34176
  const invocation = buildExternalCommandInvocation(command, args);
34177
34177
  const redirect = redirectCommandStdoutToStderr || options.redirectStdoutToStderr === true;
34178
- const child = (0, import_node_child_process8.spawn)(invocation.command, invocation.args, {
34178
+ const child = (0, import_node_child_process9.spawn)(invocation.command, invocation.args, {
34179
34179
  cwd: options.cwd,
34180
34180
  stdio: redirect ? [options.inheritStdin ? "inherit" : "ignore", "pipe", "pipe"] : "inherit",
34181
34181
  windowsVerbatimArguments: invocation.windowsVerbatimArguments
@@ -34219,7 +34219,7 @@ async function runCommand(command, args, options = {}) {
34219
34219
  async function runCommandCapture(command, args) {
34220
34220
  return await new Promise((resolvePromise, reject) => {
34221
34221
  const invocation = buildExternalCommandInvocation(command, args);
34222
- const child = (0, import_node_child_process8.spawn)(invocation.command, invocation.args, {
34222
+ const child = (0, import_node_child_process9.spawn)(invocation.command, invocation.args, {
34223
34223
  stdio: ["ignore", "pipe", "pipe"],
34224
34224
  windowsVerbatimArguments: invocation.windowsVerbatimArguments
34225
34225
  });
@@ -34252,7 +34252,7 @@ ${stderr}`));
34252
34252
  async function runCommandCaptureOptional(command, args) {
34253
34253
  return await new Promise((resolvePromise) => {
34254
34254
  const invocation = buildExternalCommandInvocation(command, args);
34255
- const child = (0, import_node_child_process8.spawn)(invocation.command, invocation.args, {
34255
+ const child = (0, import_node_child_process9.spawn)(invocation.command, invocation.args, {
34256
34256
  stdio: ["ignore", "pipe", "ignore"],
34257
34257
  windowsVerbatimArguments: invocation.windowsVerbatimArguments
34258
34258
  });
@@ -34272,7 +34272,7 @@ async function runCommandCaptureOptional(command, args) {
34272
34272
  async function runCommandCaptureStatus(command, args, options = {}) {
34273
34273
  return await new Promise((resolvePromise) => {
34274
34274
  const invocation = buildExternalCommandInvocation(command, args);
34275
- const child = (0, import_node_child_process8.spawn)(invocation.command, invocation.args, {
34275
+ const child = (0, import_node_child_process9.spawn)(invocation.command, invocation.args, {
34276
34276
  stdio: ["ignore", "pipe", "pipe"],
34277
34277
  windowsVerbatimArguments: invocation.windowsVerbatimArguments
34278
34278
  });
@@ -34345,15 +34345,15 @@ function buildExternalCommandInvocation(command, args, platform = process.platfo
34345
34345
  function formatExternalCommand(command, args) {
34346
34346
  return [command, ...args].join(" ");
34347
34347
  }
34348
- 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;
34348
+ var import_node_child_process9, import_node_fs24, import_promises11, import_node_os11, import_node_path30, 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;
34349
34349
  var init_update_cli = __esm({
34350
34350
  "src/update-cli.ts"() {
34351
34351
  "use strict";
34352
- import_node_child_process8 = require("node:child_process");
34353
- import_node_fs22 = require("node:fs");
34352
+ import_node_child_process9 = require("node:child_process");
34353
+ import_node_fs24 = require("node:fs");
34354
34354
  import_promises11 = require("node:fs/promises");
34355
34355
  import_node_os11 = require("node:os");
34356
- import_node_path28 = require("node:path");
34356
+ import_node_path30 = require("node:path");
34357
34357
  init_ai_command();
34358
34358
  init_win_spawn();
34359
34359
  init_ai_provider();
@@ -34666,7 +34666,7 @@ var require_BufferList = __commonJS({
34666
34666
  this.head = this.tail = null;
34667
34667
  this.length = 0;
34668
34668
  };
34669
- BufferList.prototype.join = function join31(s) {
34669
+ BufferList.prototype.join = function join33(s) {
34670
34670
  if (this.length === 0) return "";
34671
34671
  var p = this.head;
34672
34672
  var ret = "" + p.data;
@@ -44317,9 +44317,12 @@ __export(index_exports, {
44317
44317
  NATIVE_LAUNCHER_EXE_NAME: () => NATIVE_LAUNCHER_EXE_NAME,
44318
44318
  OPENCLAW_GATEWAY_ROUTE_GROUP_ID: () => OPENCLAW_GATEWAY_ROUTE_GROUP_ID,
44319
44319
  ProviderNotReadyError: () => ProviderNotReadyError,
44320
+ SIGNAL_PAYLOAD_TYPE: () => SIGNAL_PAYLOAD_TYPE,
44321
+ SIGNAL_SPEC_VERSION: () => SIGNAL_SPEC_VERSION,
44320
44322
  SYSTEM_NOTIFICATION_SESSION_KEY: () => SYSTEM_NOTIFICATION_SESSION_KEY,
44321
44323
  SessionBusyTracker: () => SessionBusyTracker,
44322
44324
  SessionStore: () => SessionStore,
44325
+ SignalTradingBuyerRuntime: () => SignalTradingBuyerRuntime,
44323
44326
  SqliteOutboundBehavior: () => SqliteOutboundBehavior,
44324
44327
  TASK_NAME: () => TASK_NAME,
44325
44328
  TaskMessageStore: () => TaskMessageStore,
@@ -44360,6 +44363,7 @@ __export(index_exports, {
44360
44363
  buildLaunchdPlist: () => buildLaunchdPlist,
44361
44364
  buildLauncherEntryJs: () => buildLauncherEntryJs,
44362
44365
  buildMessageEligibleArgs: () => buildMessageEligibleArgs,
44366
+ buildPolymarketExecutionPlan: () => buildPolymarketExecutionPlan,
44363
44367
  buildSchtasksCreateArgs: () => buildSchtasksCreateArgs,
44364
44368
  buildSchtasksDeleteArgs: () => buildSchtasksDeleteArgs,
44365
44369
  buildSchtasksEndArgs: () => buildSchtasksEndArgs,
@@ -44368,6 +44372,7 @@ __export(index_exports, {
44368
44372
  buildSeaConfig: () => buildSeaConfig,
44369
44373
  buildServicePath: () => buildServicePath,
44370
44374
  buildSessionKey: () => buildSessionKey,
44375
+ buildSignalEnvelopePayload: () => buildSignalEnvelopePayload,
44371
44376
  buildSystemMessageNotice: () => buildSystemMessageNotice,
44372
44377
  buildSystemStoredMessage: () => buildSystemStoredMessage,
44373
44378
  buildSystemdUserService: () => buildSystemdUserService,
@@ -44391,6 +44396,7 @@ __export(index_exports, {
44391
44396
  collectCodexAppBundledCandidates: () => collectCodexAppBundledCandidates,
44392
44397
  collectCodexCommandCandidates: () => collectCodexCommandCandidates,
44393
44398
  commandExists: () => commandExists,
44399
+ comparePositiveDecimals: () => comparePositiveDecimals,
44394
44400
  createAiToolFailureTracker: () => createAiToolFailureTracker,
44395
44401
  createFileMessageHandler: () => createFileMessageHandler,
44396
44402
  createOutboundBehavior: () => createOutboundBehavior,
@@ -44411,6 +44417,7 @@ __export(index_exports, {
44411
44417
  exportDiagnosticLogs: () => exportDiagnosticLogs,
44412
44418
  extractAiSessionId: () => extractAiSessionId,
44413
44419
  extractDirectToUserNotification: () => extractDirectToUserNotification,
44420
+ extractSignalEnvelopePayload: () => extractSignalEnvelopePayload,
44414
44421
  extractXmtpSentAtMs: () => extractXmtpSentAtMs2,
44415
44422
  findWindowsNativeOkxA2aExe: () => findWindowsNativeOkxA2aExe,
44416
44423
  followFile: () => followFile,
@@ -44422,10 +44429,12 @@ __export(index_exports, {
44422
44429
  getSessionBusyTracker: () => getSessionBusyTracker,
44423
44430
  handleCapabilitiesCommand: () => handleCapabilitiesCommand,
44424
44431
  handleDoctorCommand: () => handleDoctorCommand,
44432
+ handleSignalPublishCommand: () => handleSignalPublishCommand,
44425
44433
  handleXmtpDebugCommand: () => handleXmtpDebugCommand,
44426
44434
  handleXmtpSendCommand: () => handleXmtpSendCommand,
44427
44435
  handleXmtpTestCommand: () => handleXmtpTestCommand,
44428
44436
  hasAiRuntimeMarker: () => hasAiRuntimeMarker,
44437
+ hasSignalEnvelopePayload: () => hasSignalEnvelopePayload,
44429
44438
  hashDiagnosticFileContent: () => hashDiagnosticFileContent,
44430
44439
  heartbeatUserAttentionWatcher: () => heartbeatUserAttentionWatcher,
44431
44440
  hermesConfigEnablesOkxA2a: () => hermesConfigEnablesOkxA2a,
@@ -44451,6 +44460,7 @@ __export(index_exports, {
44451
44460
  killProcessTree: () => killProcessTree,
44452
44461
  launchdPlistHasCurrentRestartPolicy: () => launchdPlistHasCurrentRestartPolicy,
44453
44462
  listAllAgentsWithMetadata: () => listAllAgentsWithMetadata,
44463
+ loadSignalTradingConfig: () => loadSignalTradingConfig,
44454
44464
  logWinCompat: () => logWinCompat,
44455
44465
  logXmtpMessageSent: () => logXmtpMessageSent,
44456
44466
  maybeRecommendOnchainosUpgrade: () => maybeRecommendOnchainosUpgrade,
@@ -44467,6 +44477,8 @@ __export(index_exports, {
44467
44477
  parseLogsExportArgs: () => parseLogsExportArgs,
44468
44478
  parseOnchainosVersionOutput: () => parseOnchainosVersionOutput,
44469
44479
  parsePluginYamlVersion: () => parsePluginYamlVersion,
44480
+ parseSignalTradingConfig: () => parseSignalTradingConfig,
44481
+ parseTradingSignalV1: () => parseTradingSignalV1,
44470
44482
  parseWalletLoginStatus: () => parseWalletLoginStatus,
44471
44483
  parseWindowsParentProcessJson: () => parseWindowsParentProcessJson,
44472
44484
  performRuntimeSwitch: () => performRuntimeSwitch,
@@ -44516,6 +44528,8 @@ __export(index_exports, {
44516
44528
  resolveOpenClawGatewayRoute: () => resolveOpenClawGatewayRoute,
44517
44529
  resolveOpenClawGatewayRoutes: () => resolveOpenClawGatewayRoutes,
44518
44530
  resolveProviderCommandWithSelfHeal: () => resolveProviderCommandWithSelfHeal,
44531
+ resolveSignalTradingConfigPath: () => resolveSignalTradingConfigPath,
44532
+ resolveSignalTradingDir: () => resolveSignalTradingDir,
44519
44533
  resolveSystemNotificationTargets: () => resolveSystemNotificationTargets,
44520
44534
  resolveSystemdAutostartPaths: () => resolveSystemdAutostartPaths,
44521
44535
  resolveTaskConfigPath: () => resolveTaskConfigPath,
@@ -48062,6 +48076,15 @@ var CommandStore = class {
48062
48076
  createdAt: Date.now()
48063
48077
  };
48064
48078
  }
48079
+ createSignalPublishCommand(params) {
48080
+ return {
48081
+ id: (0, import_node_crypto5.randomUUID)(),
48082
+ type: "signal-publish",
48083
+ serviceId: params.serviceId,
48084
+ signal: params.signal,
48085
+ createdAt: Date.now()
48086
+ };
48087
+ }
48065
48088
  createXmtpGetConversationHistoryCommand(params) {
48066
48089
  return {
48067
48090
  id: (0, import_node_crypto5.randomUUID)(),
@@ -48370,6 +48393,10 @@ function isDaemonCommand(value) {
48370
48393
  if (parsed.type === "xmtp-send") {
48371
48394
  return typeof parsed.jobId === "string" && typeof parsed.message === "string";
48372
48395
  }
48396
+ if (parsed.type === "signal-publish") {
48397
+ const command = parsed;
48398
+ return typeof command.serviceId === "string" && !!command.signal && typeof command.signal === "object";
48399
+ }
48373
48400
  if (parsed.type === "xmtp-get-pending-list") {
48374
48401
  return true;
48375
48402
  }
@@ -61023,7 +61050,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
61023
61050
  client: {
61024
61051
  id: "gateway-client",
61025
61052
  displayName: "okx-a2a-node",
61026
- version: "0.2.9",
61053
+ version: "0.2.10-beta-98689bff7a-260826143751",
61027
61054
  platform: "node",
61028
61055
  mode: "backend",
61029
61056
  instanceId
@@ -61034,7 +61061,7 @@ function buildConnectParams(config, instanceId, protocolVersion) {
61034
61061
  commands: [],
61035
61062
  permissions: {},
61036
61063
  locale: Intl.DateTimeFormat().resolvedOptions().locale || "en-US",
61037
- userAgent: `okx-a2a-node/${"0.2.9"}`,
61064
+ userAgent: `okx-a2a-node/${"0.2.10-beta-98689bff7a-260826143751"}`,
61038
61065
  auth: {
61039
61066
  ...config.token ? { token: config.token } : {},
61040
61067
  ...config.password ? { password: config.password } : {}
@@ -64122,6 +64149,444 @@ function isRecord5(value) {
64122
64149
  return !!value && typeof value === "object" && !Array.isArray(value);
64123
64150
  }
64124
64151
 
64152
+ // src/signal-trading/publisher.ts
64153
+ var import_node_crypto12 = require("node:crypto");
64154
+
64155
+ // src/signal-trading/config.ts
64156
+ var import_node_fs19 = require("node:fs");
64157
+ var import_node_path25 = require("node:path");
64158
+ init_paths();
64159
+ var SIGNAL_TRADING_CONFIG_VERSION = 1;
64160
+ function isPlainObject2(value) {
64161
+ return !!value && typeof value === "object" && !Array.isArray(value);
64162
+ }
64163
+ function requireObject(value, path2) {
64164
+ if (!isPlainObject2(value)) {
64165
+ throw new Error(`${path2} must be an object`);
64166
+ }
64167
+ return value;
64168
+ }
64169
+ function requireString(value, path2) {
64170
+ if (typeof value !== "string" || value.trim().length === 0) {
64171
+ throw new Error(`${path2} must be a non-empty string`);
64172
+ }
64173
+ return value.trim();
64174
+ }
64175
+ function optionalString(value, path2) {
64176
+ return value === void 0 ? void 0 : requireString(value, path2);
64177
+ }
64178
+ function requireBoolean(value, path2) {
64179
+ if (typeof value !== "boolean") {
64180
+ throw new Error(`${path2} must be a boolean`);
64181
+ }
64182
+ return value;
64183
+ }
64184
+ function requireInteger(value, path2, minimum) {
64185
+ if (typeof value !== "number" || !Number.isInteger(value) || value < minimum) {
64186
+ throw new Error(`${path2} must be an integer >= ${minimum}`);
64187
+ }
64188
+ return value;
64189
+ }
64190
+ function requireArray(value, path2) {
64191
+ if (!Array.isArray(value)) {
64192
+ throw new Error(`${path2} must be an array`);
64193
+ }
64194
+ return value;
64195
+ }
64196
+ function parseStringArray2(value, path2) {
64197
+ return requireArray(value, path2).map((item, index2) => requireString(item, `${path2}[${index2}]`));
64198
+ }
64199
+ function parseProviderRoute(value, index2) {
64200
+ const path2 = `config.provider.routes[${index2}]`;
64201
+ const input = requireObject(value, path2);
64202
+ const myAgentId = optionalString(input.myAgentId, `${path2}.myAgentId`);
64203
+ const toXmtpAddress = optionalString(input.toXmtpAddress, `${path2}.toXmtpAddress`);
64204
+ return {
64205
+ serviceId: requireString(input.serviceId, `${path2}.serviceId`),
64206
+ subscriptionId: requireString(input.subscriptionId, `${path2}.subscriptionId`),
64207
+ jobId: requireString(input.jobId, `${path2}.jobId`),
64208
+ ...myAgentId ? { myAgentId } : {},
64209
+ toAgentId: requireString(input.toAgentId, `${path2}.toAgentId`),
64210
+ ...toXmtpAddress ? { toXmtpAddress } : {}
64211
+ };
64212
+ }
64213
+ function parseBuyerSubscription(value, index2) {
64214
+ const path2 = `config.buyer.subscriptions[${index2}]`;
64215
+ const input = requireObject(value, path2);
64216
+ return {
64217
+ serviceId: requireString(input.serviceId, `${path2}.serviceId`),
64218
+ subscriptionId: requireString(input.subscriptionId, `${path2}.subscriptionId`),
64219
+ jobId: requireString(input.jobId, `${path2}.jobId`),
64220
+ providerAgentId: requireString(input.providerAgentId, `${path2}.providerAgentId`)
64221
+ };
64222
+ }
64223
+ function parseRiskPolicy(value) {
64224
+ const input = requireObject(value, "config.buyer.riskPolicy");
64225
+ const allowedSides = parseStringArray2(input.allowedSides, "config.buyer.riskPolicy.allowedSides");
64226
+ for (const side of allowedSides) {
64227
+ if (side !== "BUY" && side !== "SELL") {
64228
+ throw new Error("config.buyer.riskPolicy.allowedSides supports only BUY and SELL");
64229
+ }
64230
+ }
64231
+ const allowedTokenIds = parseStringArray2(
64232
+ input.allowedTokenIds,
64233
+ "config.buyer.riskPolicy.allowedTokenIds"
64234
+ );
64235
+ if (allowedTokenIds.length === 0) {
64236
+ throw new Error("config.buyer.riskPolicy.allowedTokenIds must not be empty");
64237
+ }
64238
+ return {
64239
+ allowedTokenIds,
64240
+ allowedSides,
64241
+ ...input.minOrderAmount === void 0 ? {} : {
64242
+ minOrderAmount: requireString(
64243
+ input.minOrderAmount,
64244
+ "config.buyer.riskPolicy.minOrderAmount"
64245
+ )
64246
+ },
64247
+ maxOrderAmount: requireString(input.maxOrderAmount, "config.buyer.riskPolicy.maxOrderAmount"),
64248
+ maxSlippageBps: requireInteger(
64249
+ input.maxSlippageBps,
64250
+ "config.buyer.riskPolicy.maxSlippageBps",
64251
+ 0
64252
+ ),
64253
+ maxSignalAgeMs: requireInteger(
64254
+ input.maxSignalAgeMs,
64255
+ "config.buyer.riskPolicy.maxSignalAgeMs",
64256
+ 1
64257
+ ),
64258
+ ...input.minTimeToExpiryMs === void 0 ? {} : {
64259
+ minTimeToExpiryMs: requireInteger(
64260
+ input.minTimeToExpiryMs,
64261
+ "config.buyer.riskPolicy.minTimeToExpiryMs",
64262
+ 0
64263
+ )
64264
+ }
64265
+ };
64266
+ }
64267
+ function parseBuyer(value) {
64268
+ const input = requireObject(value, "config.buyer");
64269
+ const executionMode = requireString(input.executionMode, "config.buyer.executionMode");
64270
+ if (executionMode !== "DRY_RUN" && executionMode !== "LIVE") {
64271
+ throw new Error("config.buyer.executionMode must be DRY_RUN or LIVE");
64272
+ }
64273
+ let polymarket;
64274
+ if (input.polymarket !== void 0) {
64275
+ const polymarketInput = requireObject(input.polymarket, "config.buyer.polymarket");
64276
+ const bin = optionalString(polymarketInput.bin, "config.buyer.polymarket.bin");
64277
+ const timeoutMs = polymarketInput.timeoutMs === void 0 ? void 0 : requireInteger(polymarketInput.timeoutMs, "config.buyer.polymarket.timeoutMs", 1);
64278
+ polymarket = {
64279
+ ...bin ? { bin } : {},
64280
+ ...timeoutMs ? { timeoutMs } : {}
64281
+ };
64282
+ }
64283
+ return {
64284
+ enabled: requireBoolean(input.enabled, "config.buyer.enabled"),
64285
+ executionMode,
64286
+ subscriptions: requireArray(input.subscriptions, "config.buyer.subscriptions").map(parseBuyerSubscription),
64287
+ riskPolicy: parseRiskPolicy(input.riskPolicy),
64288
+ ...polymarket ? { polymarket } : {}
64289
+ };
64290
+ }
64291
+ function parseSignalTradingConfig(value) {
64292
+ const input = requireObject(value, "config");
64293
+ if (input.version !== SIGNAL_TRADING_CONFIG_VERSION) {
64294
+ throw new Error(`config.version must be ${SIGNAL_TRADING_CONFIG_VERSION}`);
64295
+ }
64296
+ let provider;
64297
+ if (input.provider !== void 0) {
64298
+ const providerInput = requireObject(input.provider, "config.provider");
64299
+ provider = {
64300
+ routes: requireArray(providerInput.routes, "config.provider.routes").map(parseProviderRoute)
64301
+ };
64302
+ }
64303
+ const buyer = input.buyer === void 0 ? void 0 : parseBuyer(input.buyer);
64304
+ return {
64305
+ version: SIGNAL_TRADING_CONFIG_VERSION,
64306
+ ...provider ? { provider } : {},
64307
+ ...buyer ? { buyer } : {}
64308
+ };
64309
+ }
64310
+ function resolveSignalTradingDir(homeDir) {
64311
+ return (0, import_node_path25.join)(resolveTaskPaths(homeDir).homeDir, "signal-trading");
64312
+ }
64313
+ function resolveSignalTradingConfigPath(homeDir) {
64314
+ return (0, import_node_path25.join)(resolveSignalTradingDir(homeDir), "config.json");
64315
+ }
64316
+ function loadSignalTradingConfig(homeDir) {
64317
+ const path2 = resolveSignalTradingConfigPath(homeDir);
64318
+ if (!(0, import_node_fs19.existsSync)(path2)) {
64319
+ throw new Error(`signal trading config not found: ${path2}`);
64320
+ }
64321
+ let parsed;
64322
+ try {
64323
+ parsed = JSON.parse((0, import_node_fs19.readFileSync)(path2, "utf8"));
64324
+ } catch (error) {
64325
+ throw new Error(
64326
+ `signal trading config is not valid JSON: ${path2}: ${error instanceof Error ? error.message : String(error)}`
64327
+ );
64328
+ }
64329
+ return parseSignalTradingConfig(parsed);
64330
+ }
64331
+
64332
+ // src/signal-trading/protocol.ts
64333
+ var SIGNAL_PAYLOAD_TYPE = "signal";
64334
+ var SIGNAL_SPEC_VERSION = "1.0";
64335
+ function isPlainObject3(value) {
64336
+ return !!value && typeof value === "object" && !Array.isArray(value);
64337
+ }
64338
+ function requireObject2(value, path2) {
64339
+ if (!isPlainObject3(value)) {
64340
+ throw new Error(`${path2} must be an object`);
64341
+ }
64342
+ return value;
64343
+ }
64344
+ function requireString2(value, path2) {
64345
+ if (typeof value !== "string" || value.trim().length === 0) {
64346
+ throw new Error(`${path2} must be a non-empty string`);
64347
+ }
64348
+ return value.trim();
64349
+ }
64350
+ function optionalString2(value, path2) {
64351
+ if (value === void 0) {
64352
+ return void 0;
64353
+ }
64354
+ return requireString2(value, path2);
64355
+ }
64356
+ function requireEnum(value, path2, values) {
64357
+ if (typeof value !== "string" || !values.includes(value)) {
64358
+ throw new Error(`${path2} must be one of ${values.join(", ")}`);
64359
+ }
64360
+ return value;
64361
+ }
64362
+ function requireFiniteNumber(value, path2) {
64363
+ if (typeof value !== "number" || !Number.isFinite(value)) {
64364
+ throw new Error(`${path2} must be a finite number`);
64365
+ }
64366
+ return value;
64367
+ }
64368
+ function requireInteger2(value, path2, minimum = 0) {
64369
+ const parsed = requireFiniteNumber(value, path2);
64370
+ if (!Number.isInteger(parsed) || parsed < minimum) {
64371
+ throw new Error(`${path2} must be an integer >= ${minimum}`);
64372
+ }
64373
+ return parsed;
64374
+ }
64375
+ function requireIsoTimestamp(value, path2) {
64376
+ const timestamp = requireString2(value, path2);
64377
+ if (!Number.isFinite(Date.parse(timestamp))) {
64378
+ throw new Error(`${path2} must be an ISO-8601 timestamp`);
64379
+ }
64380
+ return timestamp;
64381
+ }
64382
+ function readStringRecord2(value, path2) {
64383
+ if (value === void 0) {
64384
+ return void 0;
64385
+ }
64386
+ const input = requireObject2(value, path2);
64387
+ const result = {};
64388
+ for (const [key, item] of Object.entries(input)) {
64389
+ result[key] = requireString2(item, `${path2}.${key}`);
64390
+ }
64391
+ return result;
64392
+ }
64393
+ function parseTradingSignalV1(value) {
64394
+ const input = requireObject2(value, "signal");
64395
+ const specVersion = requireEnum(input.specVersion, "signal.specVersion", [SIGNAL_SPEC_VERSION]);
64396
+ const emittedAt = requireIsoTimestamp(input.emittedAt, "signal.emittedAt");
64397
+ const expiresAt = requireIsoTimestamp(input.expiresAt, "signal.expiresAt");
64398
+ if (Date.parse(expiresAt) <= Date.parse(emittedAt)) {
64399
+ throw new Error("signal.expiresAt must be later than signal.emittedAt");
64400
+ }
64401
+ const instrumentInput = requireObject2(input.instrument, "signal.instrument");
64402
+ const instrument = {
64403
+ symbol: requireString2(instrumentInput.symbol, "signal.instrument.symbol"),
64404
+ marketType: requireEnum(
64405
+ instrumentInput.marketType,
64406
+ "signal.instrument.marketType",
64407
+ ["SPOT", "PERP", "ONCHAIN"]
64408
+ )
64409
+ };
64410
+ const chainId = optionalString2(instrumentInput.chainId, "signal.instrument.chainId");
64411
+ const tokenIn = optionalString2(instrumentInput.tokenIn, "signal.instrument.tokenIn");
64412
+ const tokenOut = optionalString2(instrumentInput.tokenOut, "signal.instrument.tokenOut");
64413
+ if (chainId) {
64414
+ instrument.chainId = chainId;
64415
+ }
64416
+ if (tokenIn) {
64417
+ instrument.tokenIn = tokenIn;
64418
+ }
64419
+ if (tokenOut) {
64420
+ instrument.tokenOut = tokenOut;
64421
+ }
64422
+ const intentInput = requireObject2(input.intent, "signal.intent");
64423
+ const action = requireEnum(
64424
+ intentInput.action,
64425
+ "signal.intent.action",
64426
+ ["ENTER", "EXIT", "REBALANCE", "CANCEL", "NO_TRADE"]
64427
+ );
64428
+ let intent;
64429
+ if (action === "ENTER" || action === "EXIT") {
64430
+ intent = {
64431
+ action,
64432
+ side: requireEnum(intentInput.side, "signal.intent.side", ["BUY", "SELL"]),
64433
+ orderType: requireEnum(
64434
+ intentInput.orderType,
64435
+ "signal.intent.orderType",
64436
+ ["MARKET", "LIMIT"]
64437
+ )
64438
+ };
64439
+ } else if (action === "REBALANCE") {
64440
+ const targetWeightBps = requireInteger2(
64441
+ intentInput.targetWeightBps,
64442
+ "signal.intent.targetWeightBps"
64443
+ );
64444
+ if (targetWeightBps > 1e4) {
64445
+ throw new Error("signal.intent.targetWeightBps must be <= 10000");
64446
+ }
64447
+ intent = { action, targetWeightBps };
64448
+ } else if (action === "CANCEL") {
64449
+ intent = {
64450
+ action,
64451
+ targetSignalId: optionalString2(intentInput.targetSignalId, "signal.intent.targetSignalId"),
64452
+ targetExecutionId: optionalString2(
64453
+ intentInput.targetExecutionId,
64454
+ "signal.intent.targetExecutionId"
64455
+ )
64456
+ };
64457
+ } else {
64458
+ intent = {
64459
+ action,
64460
+ reason: requireString2(intentInput.reason, "signal.intent.reason")
64461
+ };
64462
+ }
64463
+ let sizing;
64464
+ if (input.sizing !== void 0) {
64465
+ const sizingInput = requireObject2(input.sizing, "signal.sizing");
64466
+ sizing = {
64467
+ type: requireEnum(
64468
+ sizingInput.type,
64469
+ "signal.sizing.type",
64470
+ ["FIXED_BASE", "FIXED_QUOTE", "PORTFOLIO_BPS"]
64471
+ ),
64472
+ value: requireString2(sizingInput.value, "signal.sizing.value")
64473
+ };
64474
+ } else if (action === "ENTER" || action === "EXIT") {
64475
+ throw new Error(`signal.sizing is required for ${action} signals`);
64476
+ }
64477
+ let constraints;
64478
+ if (input.constraints !== void 0) {
64479
+ const constraintsInput = requireObject2(input.constraints, "signal.constraints");
64480
+ constraints = {};
64481
+ const limitPrice = optionalString2(constraintsInput.limitPrice, "signal.constraints.limitPrice");
64482
+ if (limitPrice) {
64483
+ constraints.limitPrice = limitPrice;
64484
+ }
64485
+ if (constraintsInput.maxSlippageBps !== void 0) {
64486
+ constraints.maxSlippageBps = requireInteger2(
64487
+ constraintsInput.maxSlippageBps,
64488
+ "signal.constraints.maxSlippageBps"
64489
+ );
64490
+ }
64491
+ if (constraintsInput.timeInForce !== void 0) {
64492
+ constraints.timeInForce = requireEnum(
64493
+ constraintsInput.timeInForce,
64494
+ "signal.constraints.timeInForce",
64495
+ ["GTC", "IOC", "FOK"]
64496
+ );
64497
+ }
64498
+ }
64499
+ return {
64500
+ specVersion,
64501
+ signalId: requireString2(input.signalId, "signal.signalId"),
64502
+ serviceId: requireString2(input.serviceId, "signal.serviceId"),
64503
+ subscriptionId: requireString2(input.subscriptionId, "signal.subscriptionId"),
64504
+ providerAgentId: requireString2(input.providerAgentId, "signal.providerAgentId"),
64505
+ sequence: requireInteger2(input.sequence, "signal.sequence", 1),
64506
+ emittedAt,
64507
+ expiresAt,
64508
+ instrument,
64509
+ intent,
64510
+ ...sizing ? { sizing } : {},
64511
+ ...constraints ? { constraints } : {},
64512
+ ...input.metadata !== void 0 ? { metadata: readStringRecord2(input.metadata, "signal.metadata") } : {}
64513
+ };
64514
+ }
64515
+ function buildSignalEnvelopePayload(signal) {
64516
+ return { type: SIGNAL_PAYLOAD_TYPE, signal };
64517
+ }
64518
+ function extractSignalEnvelopePayload(envelope) {
64519
+ if (!isPlainObject3(envelope) || !isPlainObject3(envelope.payload)) {
64520
+ return null;
64521
+ }
64522
+ if (envelope.payload.type !== SIGNAL_PAYLOAD_TYPE) {
64523
+ return null;
64524
+ }
64525
+ return {
64526
+ type: SIGNAL_PAYLOAD_TYPE,
64527
+ signal: parseTradingSignalV1(envelope.payload.signal)
64528
+ };
64529
+ }
64530
+ function hasSignalEnvelopePayload(envelope) {
64531
+ return isPlainObject3(envelope) && isPlainObject3(envelope.payload) && envelope.payload.type === SIGNAL_PAYLOAD_TYPE;
64532
+ }
64533
+
64534
+ // src/signal-trading/publisher.ts
64535
+ async function handleSignalPublishCommand(params) {
64536
+ const signal = parseTradingSignalV1(params.command.signal);
64537
+ if (params.command.serviceId !== signal.serviceId) {
64538
+ throw new Error(
64539
+ `signal publish --service-id ${params.command.serviceId} does not match signal.serviceId ${signal.serviceId}`
64540
+ );
64541
+ }
64542
+ const config = loadSignalTradingConfig(params.homeDir);
64543
+ const routes = config.provider?.routes.filter((route) => {
64544
+ return route.serviceId === signal.serviceId && route.subscriptionId === signal.subscriptionId;
64545
+ }) ?? [];
64546
+ if (routes.length === 0) {
64547
+ throw new Error(
64548
+ `no provider route configured for serviceId=${signal.serviceId} subscriptionId=${signal.subscriptionId}`
64549
+ );
64550
+ }
64551
+ const deliveries = [];
64552
+ for (const route of routes) {
64553
+ if (route.myAgentId && route.myAgentId !== signal.providerAgentId) {
64554
+ throw new Error(
64555
+ `provider route myAgentId=${route.myAgentId} does not match signal.providerAgentId=${signal.providerAgentId}`
64556
+ );
64557
+ }
64558
+ const childCommand = {
64559
+ id: (0, import_node_crypto12.randomUUID)(),
64560
+ type: "xmtp-send",
64561
+ jobId: route.jobId,
64562
+ message: `Trading signal ${signal.signalId} from service ${signal.serviceId}`,
64563
+ sessionAgentId: route.toAgentId,
64564
+ myAgentId: route.myAgentId ?? signal.providerAgentId,
64565
+ toAgentId: route.toAgentId,
64566
+ toXmtpAddress: route.toXmtpAddress,
64567
+ payload: buildSignalEnvelopePayload(signal),
64568
+ createdAt: params.command.createdAt
64569
+ };
64570
+ const result = await handleXmtpSendCommand({
64571
+ command: childCommand,
64572
+ service: params.service,
64573
+ store: params.store,
64574
+ sessionStore: params.sessionStore
64575
+ });
64576
+ deliveries.push({
64577
+ subscriptionId: route.subscriptionId,
64578
+ jobId: route.jobId,
64579
+ toAgentId: route.toAgentId,
64580
+ messageId: result.messageId
64581
+ });
64582
+ }
64583
+ return {
64584
+ signalId: signal.signalId,
64585
+ serviceId: signal.serviceId,
64586
+ deliveries
64587
+ };
64588
+ }
64589
+
64125
64590
  // src/command-processor.ts
64126
64591
  var DEFAULT_COMMAND_EXECUTION_TIMEOUT_MS = 5e4;
64127
64592
  var DEFAULT_COMMAND_STALE_TIMEOUT_MS = 12e4;
@@ -64150,6 +64615,11 @@ function commandSentryExtra(command, extra = {}) {
64150
64615
  base.myAgentId = command.myAgentId ?? "";
64151
64616
  base.toAgentId = command.toAgentId ?? "";
64152
64617
  base.toXmtpAddress = command.toXmtpAddress ?? "";
64618
+ } else if (command.type === "signal-publish") {
64619
+ base.serviceId = command.serviceId;
64620
+ base.signalId = command.signal.signalId;
64621
+ base.subscriptionId = command.signal.subscriptionId;
64622
+ base.agentId = command.signal.providerAgentId;
64153
64623
  } else if (command.type === "xmtp-deny-pending-conversation") {
64154
64624
  base.groupId = command.groupId;
64155
64625
  base.jobId = command.jobId ?? "";
@@ -64402,6 +64872,16 @@ async function handleDaemonCommand(command, params) {
64402
64872
  });
64403
64873
  return { ok: true, messageId: result.messageId };
64404
64874
  }
64875
+ if (command.type === "signal-publish") {
64876
+ const payload = await handleSignalPublishCommand({
64877
+ command,
64878
+ service: params.service,
64879
+ store: params.store,
64880
+ sessionStore: params.sessionStore,
64881
+ homeDir: params.homeDir
64882
+ });
64883
+ return { ok: true, payload };
64884
+ }
64405
64885
  if (command.type === "xmtp-get-pending-list") {
64406
64886
  return { ok: true, payload: await listPendingTaskRequests(params) };
64407
64887
  }
@@ -64484,12 +64964,12 @@ async function listPendingTaskRequests(params) {
64484
64964
  }
64485
64965
  async function denyPendingConversationsByJobId(jobId, params, content) {
64486
64966
  const pending = await listPendingTaskRequests(params);
64487
- const matched = pending.filter((item) => isPlainObject2(item) && readString2(item.jobId) === jobId);
64967
+ const matched = pending.filter((item) => isPlainObject4(item) && readString2(item.jobId) === jobId);
64488
64968
  const clientAddresses = [...params.service.getClients().keys()];
64489
64969
  const targetsByKey = collectDenyTargetsFromPending(matched, clientAddresses);
64490
64970
  const groupIds = /* @__PURE__ */ new Set();
64491
64971
  for (const item of matched) {
64492
- if (!isPlainObject2(item)) {
64972
+ if (!isPlainObject4(item)) {
64493
64973
  continue;
64494
64974
  }
64495
64975
  const groupId = readString2(item.groupId);
@@ -64516,7 +64996,7 @@ async function denyPendingConversationsByJobId(jobId, params, content) {
64516
64996
  function collectDenyTargetsFromPending(pending, fallbackAddresses) {
64517
64997
  const targetsByKey = /* @__PURE__ */ new Map();
64518
64998
  for (const item of pending) {
64519
- if (!isPlainObject2(item)) {
64999
+ if (!isPlainObject4(item)) {
64520
65000
  continue;
64521
65001
  }
64522
65002
  const groupId = readString2(item.groupId);
@@ -64541,7 +65021,7 @@ ${groupId}`, {
64541
65021
  async function resolvePendingTargetsByGroupId(groupId, addresses, params) {
64542
65022
  const addressSet = addresses ? new Set(addresses) : null;
64543
65023
  const pending = (await listPendingTaskRequests(params)).filter((item) => {
64544
- if (!isPlainObject2(item) || readString2(item.groupId) !== groupId) {
65024
+ if (!isPlainObject4(item) || readString2(item.groupId) !== groupId) {
64545
65025
  return false;
64546
65026
  }
64547
65027
  const address = readString2(item.myXmtpAddress);
@@ -64661,7 +65141,7 @@ function filterKnownPendingGroups(items, sessionStore) {
64661
65141
  return items;
64662
65142
  }
64663
65143
  return items.filter((item) => {
64664
- if (!isPlainObject2(item)) {
65144
+ if (!isPlainObject4(item)) {
64665
65145
  return true;
64666
65146
  }
64667
65147
  const jobId = readString2(item.jobId);
@@ -64672,7 +65152,7 @@ function filterKnownPendingGroups(items, sessionStore) {
64672
65152
  return sessionStore.querySessions({ jobId, toAgentId, limit: 1 }).length === 0;
64673
65153
  });
64674
65154
  }
64675
- function isPlainObject2(value) {
65155
+ function isPlainObject4(value) {
64676
65156
  return !!value && typeof value === "object" && !Array.isArray(value);
64677
65157
  }
64678
65158
  function readString2(value) {
@@ -64806,6 +65286,11 @@ function formatCommandCompleted(command, result) {
64806
65286
  if (command.type === "xmtp-send") {
64807
65287
  return `[okx-agent-task] xmtp-send command completed id=${command.id} job=${command.jobId} messageId=${result.messageId}`;
64808
65288
  }
65289
+ if (command.type === "signal-publish") {
65290
+ const payload = isPlainObject4(result.payload) ? result.payload : {};
65291
+ const deliveries = Array.isArray(payload.deliveries) ? payload.deliveries.length : 0;
65292
+ return `[signal-trading] signal-publish command completed id=${command.id} service=${command.serviceId} signal=${command.signal.signalId} deliveries=${deliveries}`;
65293
+ }
64809
65294
  if (command.type === "xmtp-get-pending-list") {
64810
65295
  return `[okx-agent-task] xmtp-get-pending-list command completed id=${command.id}`;
64811
65296
  }
@@ -64826,8 +65311,8 @@ function formatCommandCompleted(command, result) {
64826
65311
  return `[okx-agent-task] xmtp-refresh-agents command completed id=${command.id}`;
64827
65312
  }
64828
65313
  function formatXmtpDebugCompleted(command, payload) {
64829
- const record = isPlainObject2(payload) ? payload : {};
64830
- const summary = isPlainObject2(record.summary) ? record.summary : {};
65314
+ const record = isPlainObject4(payload) ? payload : {};
65315
+ const summary = isPlainObject4(record.summary) ? record.summary : {};
64831
65316
  const count = command.action === "group-list" ? record.groupCount ?? 0 : command.action === "group-inspect" ? record.conversationFound ? 1 : 0 : summary.matchedCount ?? 0;
64832
65317
  return `[okx-agent-task] xmtp-debug command completed id=${command.id} action=${command.action} rows=${String(count)}`;
64833
65318
  }
@@ -64968,7 +65453,7 @@ function trimForUser2(value) {
64968
65453
 
64969
65454
  // src/message-handler.ts
64970
65455
  init_log();
64971
- var import_node_crypto12 = require("node:crypto");
65456
+ var import_node_crypto13 = require("node:crypto");
64972
65457
  init_sentry_logger();
64973
65458
  init_log_fields();
64974
65459
  init_paths();
@@ -64990,7 +65475,7 @@ function tryMarkProcessed(messageId) {
64990
65475
  }
64991
65476
  return true;
64992
65477
  }
64993
- function isPlainObject3(value) {
65478
+ function isPlainObject5(value) {
64994
65479
  return !!value && typeof value === "object" && !Array.isArray(value);
64995
65480
  }
64996
65481
  function safeStringify(value) {
@@ -65047,9 +65532,9 @@ function readNumber(value) {
65047
65532
  }
65048
65533
  function resolveSessionAgentId(params) {
65049
65534
  const { chatType, payload, myXmtpAddress } = params;
65050
- const payloadObject = isPlainObject3(payload) ? payload : null;
65051
- const sender = isPlainObject3(payloadObject?.sender) ? payloadObject.sender : null;
65052
- const message = isPlainObject3(payloadObject?.message) ? payloadObject.message : null;
65535
+ const payloadObject = isPlainObject5(payload) ? payload : null;
65536
+ const sender = isPlainObject5(payloadObject?.sender) ? payloadObject.sender : null;
65537
+ const message = isPlainObject5(payloadObject?.message) ? payloadObject.message : null;
65053
65538
  const localAgentId = XmtpService.getInstance().getAgentByAddress(myXmtpAddress)?.agentId ?? null;
65054
65539
  if (chatType === "group") {
65055
65540
  return readString3(sender?.agentId) ?? readString3(payloadObject?.receiverAgentId) ?? localAgentId;
@@ -65060,7 +65545,7 @@ function resolveSessionAgentId(params) {
65060
65545
  return localAgentId;
65061
65546
  }
65062
65547
  function routeMessage(chatType, parsed, payload) {
65063
- if (!parsed || !isPlainObject3(payload)) {
65548
+ if (!parsed || !isPlainObject5(payload)) {
65064
65549
  return {
65065
65550
  jobId: BACKUP_JOB_ID,
65066
65551
  route: "backup",
@@ -65072,7 +65557,7 @@ function routeMessage(chatType, parsed, payload) {
65072
65557
  return jobId ? { jobId, route: "job", routeReason: "group-job-id" } : { jobId: BACKUP_JOB_ID, route: "backup", routeReason: "group-missing-job-id" };
65073
65558
  }
65074
65559
  if (chatType === "dm") {
65075
- const message = isPlainObject3(payload.message) ? payload.message : null;
65560
+ const message = isPlainObject5(payload.message) ? payload.message : null;
65076
65561
  const nestedJobId = readString3(message?.jobId);
65077
65562
  const directJobId = readString3(payload.jobId);
65078
65563
  const jobId = nestedJobId ?? directJobId;
@@ -65085,10 +65570,10 @@ function routeMessage(chatType, parsed, payload) {
65085
65570
  return { jobId: BACKUP_JOB_ID, route: "backup", routeReason: "unknown-conversation" };
65086
65571
  }
65087
65572
  function extractDirectToUserNotification(payload) {
65088
- if (!isPlainObject3(payload)) {
65573
+ if (!isPlainObject5(payload)) {
65089
65574
  return { kind: "none" };
65090
65575
  }
65091
- const message = isPlainObject3(payload.message) ? payload.message : null;
65576
+ const message = isPlainObject5(payload.message) ? payload.message : null;
65092
65577
  if (message?.isDirectToUser !== true) {
65093
65578
  return { kind: "none" };
65094
65579
  }
@@ -65112,10 +65597,10 @@ function extractDirectToUserNotification(payload) {
65112
65597
  };
65113
65598
  }
65114
65599
  function extractSystemNotification(payload) {
65115
- if (!isPlainObject3(payload)) {
65600
+ if (!isPlainObject5(payload)) {
65116
65601
  return null;
65117
65602
  }
65118
- const message = isPlainObject3(payload.message) ? payload.message : null;
65603
+ const message = isPlainObject5(payload.message) ? payload.message : null;
65119
65604
  const isDirectCommunication = message?.isDirectCommunication === true;
65120
65605
  if (message?.source !== "system" && !isDirectCommunication) {
65121
65606
  return null;
@@ -65416,7 +65901,7 @@ function maybeNotifyInboundAgentMessage(params) {
65416
65901
  return;
65417
65902
  }
65418
65903
  const content = payloadObject.content;
65419
- const sender = isPlainObject3(payloadObject.sender) ? payloadObject.sender : null;
65904
+ const sender = isPlainObject5(payloadObject.sender) ? payloadObject.sender : null;
65420
65905
  const localAgent = XmtpService.getInstance().getAgentByAddress(params.deps.myXmtpAddress);
65421
65906
  void notifyAgentMessageToUserAttention({
65422
65907
  direction: "inbound" /* INBOUND */,
@@ -65447,11 +65932,11 @@ function stringifySystemPayload(payload) {
65447
65932
  }
65448
65933
  }
65449
65934
  function summarizePayloadForLog(payload) {
65450
- if (!isPlainObject3(payload)) {
65935
+ if (!isPlainObject5(payload)) {
65451
65936
  return "payload=non-object";
65452
65937
  }
65453
- const message = isPlainObject3(payload.message) ? payload.message : null;
65454
- const sender = isPlainObject3(payload.sender) ? payload.sender : null;
65938
+ const message = isPlainObject5(payload.message) ? payload.message : null;
65939
+ const sender = isPlainObject5(payload.sender) ? payload.sender : null;
65455
65940
  const jobId = readString3(payload.jobId) ?? readString3(message?.jobId);
65456
65941
  const parts = [
65457
65942
  readString3(payload.msgType) ? `type=${readString3(payload.msgType)}` : null,
@@ -65720,7 +66205,7 @@ async function verifyInboundA2AGroupMessage(params) {
65720
66205
  messageId,
65721
66206
  groupId,
65722
66207
  jobId,
65723
- agentId: readString3(isPlainObject3(payload.sender) ? payload.sender.agentId : null),
66208
+ agentId: readString3(isPlainObject5(payload.sender) ? payload.sender.agentId : null),
65724
66209
  localAgentId: myAgent?.agentId ?? null,
65725
66210
  senderAddress,
65726
66211
  senderInboxId,
@@ -65746,7 +66231,7 @@ async function verifyInboundA2AGroupMessage(params) {
65746
66231
  });
65747
66232
  return false;
65748
66233
  }
65749
- const sender = isPlainObject3(payload.sender) ? payload.sender : null;
66234
+ const sender = isPlainObject5(payload.sender) ? payload.sender : null;
65750
66235
  const senderAgentId = readString3(sender?.agentId);
65751
66236
  const senderRole = readNumber(sender?.role);
65752
66237
  if (!senderAgentId || !myAgent) {
@@ -65970,7 +66455,7 @@ async function processFileMessage(ctx, deps, options = {}) {
65970
66455
  timing.mark("payloadParse", parseStartedAt);
65971
66456
  const directToUser = chatType === "dm" && parseResult.ok ? extractDirectToUserNotification(parseResult.data) : { kind: "none" };
65972
66457
  if (directToUser.kind === "invalid") {
65973
- const droppedMessageId = messageId || `direct-to-user-${(0, import_node_crypto12.randomUUID)()}`;
66458
+ const droppedMessageId = messageId || `direct-to-user-${(0, import_node_crypto13.randomUUID)()}`;
65974
66459
  logger.error(
65975
66460
  LogEvent.INBOUND_DROP_DM_INVALID_PAYLOAD,
65976
66461
  new Error("Invalid direct-to-user system DM"),
@@ -65994,7 +66479,7 @@ async function processFileMessage(ctx, deps, options = {}) {
65994
66479
  await dispatchDirectToUserNotification({
65995
66480
  deps,
65996
66481
  notification: directToUser.notification,
65997
- messageId: messageId || `direct-to-user-${(0, import_node_crypto12.randomUUID)()}`,
66482
+ messageId: messageId || `direct-to-user-${(0, import_node_crypto13.randomUUID)()}`,
65998
66483
  timing,
65999
66484
  source: options.source ?? "live"
66000
66485
  });
@@ -66002,7 +66487,7 @@ async function processFileMessage(ctx, deps, options = {}) {
66002
66487
  }
66003
66488
  const systemNotification = chatType === "dm" && parseResult.ok ? extractSystemNotification(parseResult.data) : null;
66004
66489
  if (systemNotification) {
66005
- const systemMessageId = messageId || `system-${(0, import_node_crypto12.randomUUID)()}`;
66490
+ const systemMessageId = messageId || `system-${(0, import_node_crypto13.randomUUID)()}`;
66006
66491
  logWithTimestamp(
66007
66492
  `[okx-agent-task:${deps.myXmtpAddress}] xmtp_system_message_received agentId=${systemNotification.agentId ?? ""} msg=${shortenLogValue(systemMessageId)} event=${systemNotification.event ?? ""} job=${shortenLogValue(systemNotification.jobId)} conv=${conversationId} source=${options.source ?? "live"} rawBytes=${Buffer.byteLength(rawText, "utf8")} rawPreview=${previewRawEnvelope(rawText)}`
66008
66493
  );
@@ -66201,7 +66686,7 @@ async function processFileMessage(ctx, deps, options = {}) {
66201
66686
  );
66202
66687
  }
66203
66688
  if (route.route === "job" && chatType === "group") {
66204
- const payloadObject = isPlainObject3(parseResult.ok ? parseResult.data : null) ? parseResult.data : null;
66689
+ const payloadObject = isPlainObject5(parseResult.ok ? parseResult.data : null) ? parseResult.data : null;
66205
66690
  const service = XmtpService.getInstance();
66206
66691
  const trustedSystemSender = service.isTrustedSystemAccountSender({
66207
66692
  senderAddress,
@@ -66227,7 +66712,7 @@ async function processFileMessage(ctx, deps, options = {}) {
66227
66712
  });
66228
66713
  return true;
66229
66714
  }
66230
- const sender = isPlainObject3(payloadObject?.sender) ? payloadObject.sender : null;
66715
+ const sender = isPlainObject5(payloadObject?.sender) ? payloadObject.sender : null;
66231
66716
  const localAgent = service.getAgentByAddress(deps.myXmtpAddress);
66232
66717
  const myAgentId = localAgent?.agentId ?? readString3(payloadObject?.receiverAgentId) ?? sessionAgentId ?? null;
66233
66718
  const toAgentId = readString3(sender?.agentId);
@@ -66247,7 +66732,7 @@ async function processFileMessage(ctx, deps, options = {}) {
66247
66732
  if (!accepted) {
66248
66733
  return true;
66249
66734
  }
66250
- const routedMessageId = messageId || `group-${(0, import_node_crypto12.randomUUID)()}`;
66735
+ const routedMessageId = messageId || `group-${(0, import_node_crypto13.randomUUID)()}`;
66251
66736
  const sessionKey = ensureInboundGroupSession(deps, {
66252
66737
  jobId: route.jobId,
66253
66738
  myAgentId,
@@ -66255,6 +66740,35 @@ async function processFileMessage(ctx, deps, options = {}) {
66255
66740
  groupId: conversationId,
66256
66741
  toAgentXmtpAddress: senderAddress || readString3(payloadObject?.fromXmtpAddress)
66257
66742
  });
66743
+ if (hasSignalEnvelopePayload(parseResult.data)) {
66744
+ try {
66745
+ const signalPayload = extractSignalEnvelopePayload(parseResult.data);
66746
+ if (!signalPayload) {
66747
+ throw new Error("signal envelope payload is missing");
66748
+ }
66749
+ if (!toAgentId) {
66750
+ throw new Error("signal envelope sender.agentId is missing");
66751
+ }
66752
+ if (!deps.onSignalTradingSignal) {
66753
+ throw new Error("signal buyer runtime is unavailable");
66754
+ }
66755
+ await deps.onSignalTradingSignal({
66756
+ signal: signalPayload.signal,
66757
+ jobId: route.jobId,
66758
+ senderAgentId: toAgentId,
66759
+ messageId: routedMessageId
66760
+ });
66761
+ logWithTimestamp(
66762
+ `[signal-trading] inbound signal handled signal=${signalPayload.signal.signalId} service=${signalPayload.signal.serviceId} job=${shortenLogValue(route.jobId)} message=${shortenLogValue(routedMessageId)}`
66763
+ );
66764
+ } catch (error) {
66765
+ logWithTimestamp(
66766
+ `[signal-trading] inbound signal rejected job=${shortenLogValue(route.jobId)} message=${shortenLogValue(routedMessageId)}:`,
66767
+ error
66768
+ );
66769
+ }
66770
+ return true;
66771
+ }
66258
66772
  const dispatchStartedAt = Date.now();
66259
66773
  void Promise.resolve(deps.onSessionMessage?.({
66260
66774
  sessionKey,
@@ -66313,7 +66827,7 @@ async function processFileMessage(ctx, deps, options = {}) {
66313
66827
  return true;
66314
66828
  }
66315
66829
  const stored = {
66316
- id: messageId || `local-${(0, import_node_crypto12.randomUUID)()}`,
66830
+ id: messageId || `local-${(0, import_node_crypto13.randomUUID)()}`,
66317
66831
  direction: "inbound",
66318
66832
  route: route.route,
66319
66833
  routeReason: route.routeReason,
@@ -66331,8 +66845,8 @@ async function processFileMessage(ctx, deps, options = {}) {
66331
66845
  await deps.store.append(route.jobId, stored, sessionAgentId);
66332
66846
  timing.mark("storeAppend", storeAppendStartedAt);
66333
66847
  if ((route.route === "job" || parseResult.ok && !isA2AEnvelope(stored.payload)) && !options.skipNotify) {
66334
- const payloadObject = isPlainObject3(stored.payload) ? stored.payload : null;
66335
- const sender = isPlainObject3(payloadObject?.sender) ? payloadObject.sender : null;
66848
+ const payloadObject = isPlainObject5(stored.payload) ? stored.payload : null;
66849
+ const sender = isPlainObject5(payloadObject?.sender) ? payloadObject.sender : null;
66336
66850
  const localAgent = XmtpService.getInstance().getAgentByAddress(deps.myXmtpAddress);
66337
66851
  const sessionKey = route.route === "job" ? buildSessionKey({
66338
66852
  jobId: route.jobId,
@@ -66350,8 +66864,8 @@ async function processFileMessage(ctx, deps, options = {}) {
66350
66864
  });
66351
66865
  }
66352
66866
  if (route.route === "job" && chatType === "group" && conversationId && senderAddress) {
66353
- const payloadObject = isPlainObject3(stored.payload) ? stored.payload : null;
66354
- const sender = isPlainObject3(payloadObject?.sender) ? payloadObject.sender : null;
66867
+ const payloadObject = isPlainObject5(stored.payload) ? stored.payload : null;
66868
+ const sender = isPlainObject5(payloadObject?.sender) ? payloadObject.sender : null;
66355
66869
  await deps.store.updateXmtpSession(route.jobId, {
66356
66870
  xmtpGroupId: conversationId,
66357
66871
  myXmtpAddress: deps.myXmtpAddress,
@@ -66478,7 +66992,8 @@ function createMiddlewareFromCoreDeps(store, deps, extra) {
66478
66992
  allowGroup: deps.allowGroup,
66479
66993
  onMessageProcessed: deps.onMessageProcessed,
66480
66994
  onJobMessageStored: extra?.onJobMessageStored,
66481
- onSessionMessage: extra?.onSessionMessage
66995
+ onSessionMessage: extra?.onSessionMessage,
66996
+ onSignalTradingSignal: extra?.onSignalTradingSignal
66482
66997
  });
66483
66998
  }
66484
66999
  function processOfflineFromCoreDeps(store, ctx, deps, options) {
@@ -66488,13 +67003,14 @@ function processOfflineFromCoreDeps(store, ctx, deps, options) {
66488
67003
  sessionStore: options.sessionStore,
66489
67004
  allowGroup: deps.allowGroup,
66490
67005
  onJobMessageStored: options.onJobMessageStored,
66491
- onSessionMessage: options.onSessionMessage
67006
+ onSessionMessage: options.onSessionMessage,
67007
+ onSignalTradingSignal: options.onSignalTradingSignal
66492
67008
  }, { ...options, source: "replay" });
66493
67009
  }
66494
67010
  function buildSystemStoredMessage(params) {
66495
67011
  const now = Date.now();
66496
67012
  return {
66497
- id: params.id ?? `system-${now}-${(0, import_node_crypto12.randomUUID)()}`,
67013
+ id: params.id ?? `system-${now}-${(0, import_node_crypto13.randomUUID)()}`,
66498
67014
  direction: "system",
66499
67015
  route: "backup",
66500
67016
  routeReason: params.reason,
@@ -66510,15 +67026,309 @@ function buildSystemStoredMessage(params) {
66510
67026
  };
66511
67027
  }
66512
67028
  function isA2AEnvelope(payload) {
66513
- return isPlainObject3(payload) && payload.msgType === A2A_MESSAGE_TYPE;
67029
+ return isPlainObject5(payload) && payload.msgType === A2A_MESSAGE_TYPE;
67030
+ }
67031
+
67032
+ // src/signal-trading/execution.ts
67033
+ var import_node_child_process7 = require("node:child_process");
67034
+ var import_node_crypto14 = require("node:crypto");
67035
+ var import_node_fs20 = require("node:fs");
67036
+ var import_node_path26 = require("node:path");
67037
+ var import_node_util3 = require("node:util");
67038
+ init_log();
67039
+ var execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process7.execFile);
67040
+ var DEFAULT_POLYMARKET_TIMEOUT_MS = 3e4;
67041
+ var MAX_POLYMARKET_OUTPUT_BYTES = 1048576;
67042
+ var MAX_RECEIPT_OUTPUT_CHARS = 16384;
67043
+ var MAX_FUTURE_CLOCK_SKEW_MS = 3e4;
67044
+ function defaultPolymarketCommandRunner(bin, args, options) {
67045
+ return execFileAsync3(bin, args, {
67046
+ windowsHide: true,
67047
+ timeout: options.timeoutMs,
67048
+ maxBuffer: MAX_POLYMARKET_OUTPUT_BYTES
67049
+ });
67050
+ }
67051
+ function normalizeDecimal(value, path2) {
67052
+ const trimmed = value.trim();
67053
+ const match = /^(?:0|[1-9]\d*)(?:\.(\d+))?$/.exec(trimmed);
67054
+ if (!match || /^0(?:\.0+)?$/.test(trimmed)) {
67055
+ throw new Error(`${path2} must be a positive decimal string`);
67056
+ }
67057
+ const fraction = match[1] ?? "";
67058
+ return {
67059
+ digits: BigInt(trimmed.replace(".", "")),
67060
+ scale: fraction.length
67061
+ };
67062
+ }
67063
+ function comparePositiveDecimals(left, right) {
67064
+ const a = normalizeDecimal(left, "left decimal");
67065
+ const b = normalizeDecimal(right, "right decimal");
67066
+ const scale = Math.max(a.scale, b.scale);
67067
+ const aScaled = a.digits * 10n ** BigInt(scale - a.scale);
67068
+ const bScaled = b.digits * 10n ** BigInt(scale - b.scale);
67069
+ return aScaled < bScaled ? -1 : aScaled > bScaled ? 1 : 0;
67070
+ }
67071
+ function requireBuyerSubscription(buyer, signal, context) {
67072
+ const subscription = buyer.subscriptions.find((candidate) => {
67073
+ return candidate.serviceId === signal.serviceId && candidate.subscriptionId === signal.subscriptionId && candidate.jobId === context.jobId && candidate.providerAgentId === signal.providerAgentId;
67074
+ });
67075
+ if (!subscription) {
67076
+ throw new Error(
67077
+ `signal subscription is not configured for serviceId=${signal.serviceId} subscriptionId=${signal.subscriptionId} jobId=${context.jobId}`
67078
+ );
67079
+ }
67080
+ if (context.senderAgentId !== signal.providerAgentId) {
67081
+ throw new Error(
67082
+ `signal providerAgentId=${signal.providerAgentId} does not match verified senderAgentId=${context.senderAgentId}`
67083
+ );
67084
+ }
67085
+ }
67086
+ function buildPolymarketExecutionPlan(signalValue, buyer, context, nowMs = Date.now()) {
67087
+ const signal = parseTradingSignalV1(signalValue);
67088
+ validateSignalPreconditions(signal, buyer, context, nowMs);
67089
+ if (signal.intent.action !== "ENTER" && signal.intent.action !== "EXIT") {
67090
+ throw new Error(`Polymarket demo does not execute ${signal.intent.action} signals`);
67091
+ }
67092
+ if (!signal.sizing) {
67093
+ throw new Error(`signal.sizing is required for ${signal.intent.action} signals`);
67094
+ }
67095
+ if (signal.intent.orderType !== "MARKET") {
67096
+ throw new Error("Polymarket demo currently supports MARKET orders only");
67097
+ }
67098
+ if (!buyer.riskPolicy.allowedSides.includes(signal.intent.side)) {
67099
+ throw new Error(`signal side ${signal.intent.side} is not allowed by risk policy`);
67100
+ }
67101
+ const expectedSizing = signal.intent.side === "BUY" ? "FIXED_QUOTE" : "FIXED_BASE";
67102
+ if (signal.sizing.type !== expectedSizing) {
67103
+ throw new Error(`${signal.intent.side} market orders require sizing.type=${expectedSizing}`);
67104
+ }
67105
+ normalizeDecimal(signal.sizing.value, "signal.sizing.value");
67106
+ if (buyer.riskPolicy.minOrderAmount && comparePositiveDecimals(signal.sizing.value, buyer.riskPolicy.minOrderAmount) < 0) {
67107
+ throw new Error(
67108
+ `signal amount ${signal.sizing.value} is below risk minOrderAmount ${buyer.riskPolicy.minOrderAmount}`
67109
+ );
67110
+ }
67111
+ normalizeDecimal(buyer.riskPolicy.maxOrderAmount, "config.buyer.riskPolicy.maxOrderAmount");
67112
+ if (comparePositiveDecimals(signal.sizing.value, buyer.riskPolicy.maxOrderAmount) > 0) {
67113
+ throw new Error(
67114
+ `signal amount ${signal.sizing.value} exceeds risk maxOrderAmount ${buyer.riskPolicy.maxOrderAmount}`
67115
+ );
67116
+ }
67117
+ if (signal.constraints?.maxSlippageBps !== void 0 && signal.constraints.maxSlippageBps > buyer.riskPolicy.maxSlippageBps) {
67118
+ throw new Error(
67119
+ `signal maxSlippageBps ${signal.constraints.maxSlippageBps} exceeds risk policy ${buyer.riskPolicy.maxSlippageBps}`
67120
+ );
67121
+ }
67122
+ const tokenId = signal.metadata?.polymarketTokenId ?? signal.instrument.symbol;
67123
+ if (!buyer.riskPolicy.allowedTokenIds.includes(tokenId)) {
67124
+ throw new Error(`Polymarket token ${tokenId} is not allowlisted`);
67125
+ }
67126
+ const side = signal.intent.side.toLowerCase();
67127
+ return {
67128
+ bin: buyer.polymarket?.bin ?? process.env.POLYMARKET_BIN ?? "polymarket",
67129
+ args: [
67130
+ "-o",
67131
+ "json",
67132
+ "clob",
67133
+ "market-order",
67134
+ "--token",
67135
+ tokenId,
67136
+ "--side",
67137
+ side,
67138
+ "--amount",
67139
+ signal.sizing.value
67140
+ ],
67141
+ tokenId,
67142
+ side,
67143
+ amount: signal.sizing.value
67144
+ };
67145
+ }
67146
+ function validateSignalPreconditions(signal, buyer, context, nowMs) {
67147
+ if (!buyer.enabled) {
67148
+ throw new Error("signal buyer runtime is disabled");
67149
+ }
67150
+ requireBuyerSubscription(buyer, signal, context);
67151
+ const emittedAtMs = Date.parse(signal.emittedAt);
67152
+ const expiresAtMs = Date.parse(signal.expiresAt);
67153
+ if (expiresAtMs <= nowMs) {
67154
+ throw new Error(`signal ${signal.signalId} is expired`);
67155
+ }
67156
+ if (buyer.riskPolicy.minTimeToExpiryMs !== void 0 && expiresAtMs - nowMs < buyer.riskPolicy.minTimeToExpiryMs) {
67157
+ throw new Error(
67158
+ `signal ${signal.signalId} expires too soon for minTimeToExpiryMs=${buyer.riskPolicy.minTimeToExpiryMs}`
67159
+ );
67160
+ }
67161
+ if (emittedAtMs > nowMs + MAX_FUTURE_CLOCK_SKEW_MS) {
67162
+ throw new Error(`signal ${signal.signalId} emittedAt is too far in the future`);
67163
+ }
67164
+ if (nowMs - emittedAtMs > buyer.riskPolicy.maxSignalAgeMs) {
67165
+ throw new Error(`signal ${signal.signalId} exceeds maxSignalAgeMs`);
67166
+ }
67167
+ if (signal.instrument.marketType !== "ONCHAIN") {
67168
+ throw new Error("Polymarket execution requires instrument.marketType=ONCHAIN");
67169
+ }
67170
+ if (signal.metadata?.venue?.toLowerCase() !== "polymarket") {
67171
+ throw new Error("signal.metadata.venue must be polymarket");
67172
+ }
67173
+ }
67174
+ function receiptPath(homeDir, idempotencyKey) {
67175
+ const digest = (0, import_node_crypto14.createHash)("sha256").update(idempotencyKey).digest("hex");
67176
+ return (0, import_node_path26.join)(resolveSignalTradingDir(homeDir), "executions", `${digest}.json`);
67177
+ }
67178
+ function readReceipt(path2) {
67179
+ if (!(0, import_node_fs20.existsSync)(path2)) {
67180
+ return null;
67181
+ }
67182
+ try {
67183
+ return JSON.parse((0, import_node_fs20.readFileSync)(path2, "utf8"));
67184
+ } catch {
67185
+ return null;
67186
+ }
66514
67187
  }
67188
+ function claimReceipt(path2, receipt) {
67189
+ (0, import_node_fs20.mkdirSync)((0, import_node_path26.join)(path2, ".."), { recursive: true });
67190
+ let fd;
67191
+ try {
67192
+ fd = (0, import_node_fs20.openSync)(path2, "wx", 384);
67193
+ } catch (error) {
67194
+ if (error.code === "EEXIST") {
67195
+ return false;
67196
+ }
67197
+ throw error;
67198
+ }
67199
+ try {
67200
+ (0, import_node_fs20.writeSync)(fd, JSON.stringify(receipt, null, 2));
67201
+ } finally {
67202
+ (0, import_node_fs20.closeSync)(fd);
67203
+ }
67204
+ return true;
67205
+ }
67206
+ function updateReceipt(path2, receipt) {
67207
+ const temporaryPath = `${path2}.${process.pid}.${(0, import_node_crypto14.randomUUID)()}.tmp`;
67208
+ (0, import_node_fs20.writeFileSync)(temporaryPath, JSON.stringify(receipt, null, 2), { mode: 384 });
67209
+ (0, import_node_fs20.renameSync)(temporaryPath, path2);
67210
+ }
67211
+ function boundedOutput(value) {
67212
+ if (typeof value !== "string" || value.length === 0) {
67213
+ return void 0;
67214
+ }
67215
+ return value.slice(0, MAX_RECEIPT_OUTPUT_CHARS);
67216
+ }
67217
+ var SignalTradingBuyerRuntime = class {
67218
+ constructor(homeDir, runner = defaultPolymarketCommandRunner) {
67219
+ this.homeDir = homeDir;
67220
+ this.runner = runner;
67221
+ }
67222
+ homeDir;
67223
+ runner;
67224
+ async process(signalValue, context) {
67225
+ const config = loadSignalTradingConfig(this.homeDir);
67226
+ if (!config.buyer) {
67227
+ throw new Error("signal buyer config is missing");
67228
+ }
67229
+ const signal = parseTradingSignalV1(signalValue);
67230
+ const idempotencyKey = `${signal.providerAgentId}:${signal.subscriptionId}:${signal.signalId}`;
67231
+ const path2 = receiptPath(this.homeDir, idempotencyKey);
67232
+ const now = (/* @__PURE__ */ new Date()).toISOString();
67233
+ if (signal.intent.action === "NO_TRADE") {
67234
+ validateSignalPreconditions(signal, config.buyer, context, Date.now());
67235
+ const receipt = {
67236
+ idempotencyKey,
67237
+ signalId: signal.signalId,
67238
+ serviceId: signal.serviceId,
67239
+ subscriptionId: signal.subscriptionId,
67240
+ providerAgentId: signal.providerAgentId,
67241
+ jobId: context.jobId,
67242
+ messageId: context.messageId,
67243
+ status: "SKIPPED",
67244
+ executionMode: config.buyer.executionMode,
67245
+ skipReason: signal.intent.reason,
67246
+ createdAt: now,
67247
+ updatedAt: now
67248
+ };
67249
+ if (!claimReceipt(path2, receipt)) {
67250
+ const existing = readReceipt(path2);
67251
+ if (!existing) {
67252
+ throw new Error(`signal execution receipt exists but cannot be read: ${path2}`);
67253
+ }
67254
+ return { handled: true, duplicate: true, receipt: existing };
67255
+ }
67256
+ logWithTimestamp(
67257
+ `[signal-trading] skipped NO_TRADE signal=${signal.signalId} service=${signal.serviceId} job=${context.jobId} reason=${signal.intent.reason}`
67258
+ );
67259
+ return { handled: true, duplicate: false, receipt };
67260
+ }
67261
+ const plan = buildPolymarketExecutionPlan(signal, config.buyer, context);
67262
+ const initialReceipt = {
67263
+ idempotencyKey,
67264
+ signalId: signal.signalId,
67265
+ serviceId: signal.serviceId,
67266
+ subscriptionId: signal.subscriptionId,
67267
+ providerAgentId: signal.providerAgentId,
67268
+ jobId: context.jobId,
67269
+ messageId: context.messageId,
67270
+ status: "PROCESSING",
67271
+ executionMode: config.buyer.executionMode,
67272
+ command: { bin: plan.bin, args: plan.args },
67273
+ createdAt: now,
67274
+ updatedAt: now
67275
+ };
67276
+ if (!claimReceipt(path2, initialReceipt)) {
67277
+ const existing = readReceipt(path2);
67278
+ if (!existing) {
67279
+ throw new Error(`signal execution receipt exists but cannot be read: ${path2}`);
67280
+ }
67281
+ return { handled: true, duplicate: true, receipt: existing };
67282
+ }
67283
+ if (config.buyer.executionMode === "DRY_RUN") {
67284
+ const receipt = {
67285
+ ...initialReceipt,
67286
+ status: "DRY_RUN",
67287
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
67288
+ };
67289
+ updateReceipt(path2, receipt);
67290
+ logWithTimestamp(
67291
+ `[signal-trading] dry-run signal=${signal.signalId} service=${signal.serviceId} job=${context.jobId}`
67292
+ );
67293
+ return { handled: true, duplicate: false, receipt };
67294
+ }
67295
+ try {
67296
+ const result = await this.runner(plan.bin, plan.args, {
67297
+ timeoutMs: config.buyer.polymarket?.timeoutMs ?? DEFAULT_POLYMARKET_TIMEOUT_MS
67298
+ });
67299
+ const receipt = {
67300
+ ...initialReceipt,
67301
+ status: "SUBMITTED",
67302
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
67303
+ ...boundedOutput(result.stdout) ? { stdout: boundedOutput(result.stdout) } : {},
67304
+ ...boundedOutput(result.stderr) ? { stderr: boundedOutput(result.stderr) } : {}
67305
+ };
67306
+ updateReceipt(path2, receipt);
67307
+ logWithTimestamp(
67308
+ `[signal-trading] Polymarket order submitted signal=${signal.signalId} service=${signal.serviceId} job=${context.jobId}`
67309
+ );
67310
+ return { handled: true, duplicate: false, receipt };
67311
+ } catch (error) {
67312
+ const receipt = {
67313
+ ...initialReceipt,
67314
+ status: "UNKNOWN",
67315
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
67316
+ error: error instanceof Error ? error.message : String(error)
67317
+ };
67318
+ updateReceipt(path2, receipt);
67319
+ throw new Error(
67320
+ `Polymarket CLI execution became UNKNOWN for signal=${signal.signalId}; automatic retry is disabled: ${receipt.error}`
67321
+ );
67322
+ }
67323
+ }
67324
+ };
66515
67325
 
66516
67326
  // src/listener.ts
66517
67327
  init_log();
66518
- var import_node_fs19 = require("node:fs");
67328
+ var import_node_fs21 = require("node:fs");
66519
67329
  var import_promises8 = require("node:fs/promises");
66520
67330
  var import_node_os9 = require("node:os");
66521
- var import_node_path25 = require("node:path");
67331
+ var import_node_path27 = require("node:path");
66522
67332
 
66523
67333
  // ../core/src/xmtp-sdk/onchainos/signer.ts
66524
67334
  init_log();
@@ -66656,7 +67466,7 @@ async function enqueueAiSessionMessageDispatch(params) {
66656
67466
  init_paths();
66657
67467
 
66658
67468
  // src/user-attention-watchers.ts
66659
- var import_node_crypto13 = require("node:crypto");
67469
+ var import_node_crypto15 = require("node:crypto");
66660
67470
  init_sentry_logger();
66661
67471
  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.";
66662
67472
  var USER_ATTENTION_WATCHER_SCAN_MS = 500;
@@ -66699,7 +67509,7 @@ function isOriginalParentProcessAlive(options) {
66699
67509
  }
66700
67510
  function registerUserAttentionWatcher(options) {
66701
67511
  return options.store.registerUserAttentionWatcher({
66702
- id: options.id ?? (0, import_node_crypto13.randomUUID)(),
67512
+ id: options.id ?? (0, import_node_crypto15.randomUUID)(),
66703
67513
  provider: options.provider,
66704
67514
  jobId: options.jobId,
66705
67515
  nowMs: options.nowMs ?? Date.now(),
@@ -67024,12 +67834,12 @@ async function isGatewayAvailableForHeartbeat(options) {
67024
67834
  }
67025
67835
  async function getHermesGatewayPluginStatus(options = {}) {
67026
67836
  const env = options.env ?? process.env;
67027
- const hermesHome = env.HERMES_HOME?.trim() || (0, import_node_path25.join)((0, import_node_os9.homedir)(), ".hermes");
67028
- const pluginYamlPath = (0, import_node_path25.join)(hermesHome, "plugins", "platforms", "okx-a2a", "plugin.yaml");
67029
- if (!(0, import_node_fs19.existsSync)(pluginYamlPath)) {
67837
+ const hermesHome = env.HERMES_HOME?.trim() || (0, import_node_path27.join)((0, import_node_os9.homedir)(), ".hermes");
67838
+ const pluginYamlPath = (0, import_node_path27.join)(hermesHome, "plugins", "platforms", "okx-a2a", "plugin.yaml");
67839
+ if (!(0, import_node_fs21.existsSync)(pluginYamlPath)) {
67030
67840
  return { enabled: false, reason: "plugin_yaml_missing", hermesHome, checkedPath: pluginYamlPath };
67031
67841
  }
67032
- const configPath = (0, import_node_path25.join)(hermesHome, "config.yaml");
67842
+ const configPath = (0, import_node_path27.join)(hermesHome, "config.yaml");
67033
67843
  let content;
67034
67844
  try {
67035
67845
  content = await (0, import_promises8.readFile)(configPath, "utf8");
@@ -67191,6 +68001,7 @@ async function runListenerWithLock(options, paths) {
67191
68001
  logWithTimestamp("[okx-agent-task] user_attention watcher coordinator scanning SQLite watcher state");
67192
68002
  let stopping = false;
67193
68003
  const service = XmtpService.getInstance();
68004
+ const signalBuyerRuntime = new SignalTradingBuyerRuntime(options.homeDir);
67194
68005
  const agentRefreshCoordinator = new AgentRefreshCoordinator({
67195
68006
  lookup: (previousFingerprint) => listAllAgentsWithMetadata(previousFingerprint),
67196
68007
  refresh: () => service.refreshAgents(),
@@ -67221,6 +68032,9 @@ async function runListenerWithLock(options, paths) {
67221
68032
  },
67222
68033
  onSessionMessage: async (event) => {
67223
68034
  await enqueueAiSessionMessageDispatch({ commands, event });
68035
+ },
68036
+ onSignalTradingSignal: async (event) => {
68037
+ await signalBuyerRuntime.process(event.signal, event);
67224
68038
  }
67225
68039
  }),
67226
68040
  processOfflineMessage: (ctx, deps, replayOptions) => processOfflineFromCoreDeps(store, ctx, deps, {
@@ -67231,6 +68045,9 @@ async function runListenerWithLock(options, paths) {
67231
68045
  },
67232
68046
  onSessionMessage: async (event) => {
67233
68047
  await enqueueAiSessionMessageDispatch({ commands, event });
68048
+ },
68049
+ onSignalTradingSignal: async (event) => {
68050
+ await signalBuyerRuntime.process(event.signal, event);
67234
68051
  }
67235
68052
  }),
67236
68053
  notifySessionExpired: (command) => {
@@ -67262,12 +68079,12 @@ async function runListenerWithLock(options, paths) {
67262
68079
  });
67263
68080
  }
67264
68081
  });
67265
- service.setPluginVersion("0.2.9");
68082
+ service.setPluginVersion("0.2.10-beta-98689bff7a-260826143751");
67266
68083
  await service.init();
67267
68084
  const pluginVersionStatus = service.pluginVersionStatus;
67268
68085
  if (pluginVersionStatus.unavailable) {
67269
68086
  throw new Error(
67270
- `@okxweb3/a2a-node v${"0.2.9"} is below the required minimum v${pluginVersionStatus.minVersion}`
68087
+ `@okxweb3/a2a-node v${"0.2.10-beta-98689bff7a-260826143751"} is below the required minimum v${pluginVersionStatus.minVersion}`
67271
68088
  );
67272
68089
  }
67273
68090
  const systemConfig = service.getSystemConfig();
@@ -67295,7 +68112,7 @@ async function runListenerWithLock(options, paths) {
67295
68112
  onchainosAgentId: "*",
67296
68113
  reason: "system-config missing sentryDsn",
67297
68114
  pluginId: "@okxweb3/a2a-node",
67298
- pluginVersion: "0.2.9"
68115
+ pluginVersion: "0.2.10-beta-98689bff7a-260826143751"
67299
68116
  });
67300
68117
  }
67301
68118
  logWithTimestamp(
@@ -67731,11 +68548,11 @@ init_paths();
67731
68548
 
67732
68549
  // src/xmtp-test-cli.ts
67733
68550
  var import_promises10 = require("node:fs/promises");
67734
- var import_node_path26 = require("node:path");
68551
+ var import_node_path28 = require("node:path");
67735
68552
  init_daemon();
67736
68553
 
67737
68554
  // src/log-tail.ts
67738
- var import_node_fs20 = require("node:fs");
68555
+ var import_node_fs22 = require("node:fs");
67739
68556
  var import_promises9 = require("node:fs/promises");
67740
68557
  var import_node_string_decoder = require("node:string_decoder");
67741
68558
  init_win_spawn();
@@ -67859,7 +68676,7 @@ async function followFile(filePath, onData, options = {}) {
67859
68676
  void check();
67860
68677
  }, pollIntervalMs);
67861
68678
  try {
67862
- watcher = (0, import_node_fs20.watch)(filePath, () => {
68679
+ watcher = (0, import_node_fs22.watch)(filePath, () => {
67863
68680
  void check();
67864
68681
  });
67865
68682
  watcher.on("error", (error) => {
@@ -67974,9 +68791,9 @@ async function handleXmtpTestCommand(args, releaseInfo) {
67974
68791
  async function startXmtpTest(args, releaseInfo) {
67975
68792
  assertKnownOptions(args, /* @__PURE__ */ new Set(["--name", "--run-id", "--json"]));
67976
68793
  const paths = resolveTaskPaths();
67977
- const testsDir = (0, import_node_path26.join)(paths.homeDir, "xmtp-tests");
68794
+ const testsDir = (0, import_node_path28.join)(paths.homeDir, "xmtp-tests");
67978
68795
  await ensurePrivateDir(testsDir);
67979
- const active = await readJsonIfExists((0, import_node_path26.join)(testsDir, ACTIVE_FILE));
68796
+ const active = await readJsonIfExists((0, import_node_path28.join)(testsDir, ACTIVE_FILE));
67980
68797
  if (active?.runId) {
67981
68798
  throw new Error(
67982
68799
  `XMTP test ${active.runId} is already active. Run \`okx-a2a xmtp-test stop\` first.`
@@ -68015,7 +68832,7 @@ async function startXmtpTest(args, releaseInfo) {
68015
68832
  ...releaseInfo
68016
68833
  };
68017
68834
  await writeJson(files.manifestPath, manifest);
68018
- await writeJson((0, import_node_path26.join)(testsDir, ACTIVE_FILE), {
68835
+ await writeJson((0, import_node_path28.join)(testsDir, ACTIVE_FILE), {
68019
68836
  runId,
68020
68837
  startedAt: manifest.startedAt
68021
68838
  });
@@ -68038,7 +68855,7 @@ Run \`okx-a2a xmtp-test watch\` to open the realtime dashboard.`);
68038
68855
  async function stopXmtpTest(args) {
68039
68856
  assertKnownOptions(args, /* @__PURE__ */ new Set(["--json"]));
68040
68857
  const testsDir = resolveTestsDir();
68041
- const activePath = (0, import_node_path26.join)(testsDir, ACTIVE_FILE);
68858
+ const activePath = (0, import_node_path28.join)(testsDir, ACTIVE_FILE);
68042
68859
  const active = await readJsonIfExists(activePath);
68043
68860
  if (!active?.runId) {
68044
68861
  throw new Error("No active XMTP test.");
@@ -68332,17 +69149,17 @@ function formatJobEvent(event) {
68332
69149
  return `${timestamp} ${businessEvent.padEnd(34)} ${role}#${agent} ${source}${timings.length > 0 ? ` ${timings.join(" ")}` : ""}`;
68333
69150
  }
68334
69151
  function resolveTestsDir() {
68335
- return (0, import_node_path26.join)(resolveTaskPaths().homeDir, "xmtp-tests");
69152
+ return (0, import_node_path28.join)(resolveTaskPaths().homeDir, "xmtp-tests");
68336
69153
  }
68337
69154
  function resolveRunFiles(testsDir, runId) {
68338
69155
  validateRunId(runId);
68339
- const runDir = (0, import_node_path26.join)(testsDir, runId);
69156
+ const runDir = (0, import_node_path28.join)(testsDir, runId);
68340
69157
  return {
68341
69158
  testsDir,
68342
69159
  runDir,
68343
- manifestPath: (0, import_node_path26.join)(runDir, "manifest.json"),
68344
- eventsPath: (0, import_node_path26.join)(runDir, "events.jsonl"),
68345
- summaryPath: (0, import_node_path26.join)(runDir, "summary.json")
69160
+ manifestPath: (0, import_node_path28.join)(runDir, "manifest.json"),
69161
+ eventsPath: (0, import_node_path28.join)(runDir, "events.jsonl"),
69162
+ summaryPath: (0, import_node_path28.join)(runDir, "summary.json")
68346
69163
  };
68347
69164
  }
68348
69165
  async function resolveRequestedRunId(testsDir, args, preferActive = false) {
@@ -68350,7 +69167,7 @@ async function resolveRequestedRunId(testsDir, args, preferActive = false) {
68350
69167
  if (requested) {
68351
69168
  return validateRunId(requested);
68352
69169
  }
68353
- const active = await readJsonIfExists((0, import_node_path26.join)(testsDir, ACTIVE_FILE));
69170
+ const active = await readJsonIfExists((0, import_node_path28.join)(testsDir, ACTIVE_FILE));
68354
69171
  if (active?.runId && (preferActive || !args.includes("--latest"))) {
68355
69172
  return validateRunId(active.runId);
68356
69173
  }
@@ -68376,7 +69193,7 @@ async function findLatestRunId(testsDir) {
68376
69193
  continue;
68377
69194
  }
68378
69195
  const manifest = await readJsonIfExists(
68379
- (0, import_node_path26.join)(testsDir, entry.name, "manifest.json")
69196
+ (0, import_node_path28.join)(testsDir, entry.name, "manifest.json")
68380
69197
  );
68381
69198
  if (manifest?.runId && manifest.startedAt) {
68382
69199
  manifests.push(manifest);
@@ -68677,23 +69494,23 @@ function handleCapabilitiesCommand(args) {
68677
69494
  }
68678
69495
 
68679
69496
  // src/logs-export.ts
68680
- var import_node_child_process10 = require("node:child_process");
68681
- var import_node_fs27 = require("node:fs");
69497
+ var import_node_child_process11 = require("node:child_process");
69498
+ var import_node_fs29 = require("node:fs");
68682
69499
  var import_promises15 = require("node:fs/promises");
68683
69500
  var import_node_os13 = require("node:os");
68684
- var import_node_path33 = require("node:path");
69501
+ var import_node_path35 = require("node:path");
68685
69502
  var import_jszip = __toESM(require_lib3());
68686
69503
 
68687
69504
  // src/logs-export-archive.ts
68688
- var import_node_crypto14 = require("node:crypto");
68689
- var import_node_fs24 = require("node:fs");
69505
+ var import_node_crypto16 = require("node:crypto");
69506
+ var import_node_fs26 = require("node:fs");
68690
69507
  var import_promises13 = require("node:fs/promises");
68691
- var import_node_path30 = require("node:path");
69508
+ var import_node_path32 = require("node:path");
68692
69509
 
68693
69510
  // src/logs-export-filter.ts
68694
- var import_node_fs23 = require("node:fs");
69511
+ var import_node_fs25 = require("node:fs");
68695
69512
  var import_promises12 = require("node:fs/promises");
68696
- var import_node_path29 = require("node:path");
69513
+ var import_node_path31 = require("node:path");
68697
69514
  var import_node_readline2 = require("node:readline");
68698
69515
  var MAX_SINGLE_RECORD_BYTES = 2 * 1024 * 1024;
68699
69516
  var CONTENT_KEYS = /* @__PURE__ */ new Set([
@@ -68758,7 +69575,7 @@ async function readFilteredLog(path2, options, correlationIds, requireCorrelatio
68758
69575
  let excludedOutsideWindow = 0;
68759
69576
  let excludedNoCorrelation = 0;
68760
69577
  let truncated = false;
68761
- const mode = (0, import_node_path29.basename)(path2) === "llm.log" ? "llm" : recordMode;
69578
+ const mode = (0, import_node_path31.basename)(path2) === "llm.log" ? "llm" : recordMode;
68762
69579
  const filterByTime = options.fromMs !== void 0 && options.toMs !== void 0;
68763
69580
  for await (const record of streamLogRecords(path2, mode)) {
68764
69581
  if (options.jobId && recordExplicitlyNamesForeignJob(record.lines, options.jobId)) {
@@ -68802,7 +69619,7 @@ async function readFilteredLog(path2, options, correlationIds, requireCorrelatio
68802
69619
  };
68803
69620
  }
68804
69621
  async function* streamLogRecords(path2, mode) {
68805
- const input = (0, import_node_fs23.createReadStream)(path2, { encoding: "utf8" });
69622
+ const input = (0, import_node_fs25.createReadStream)(path2, { encoding: "utf8" });
68806
69623
  const lines = (0, import_node_readline2.createInterface)({ input, crlfDelay: Infinity });
68807
69624
  let current = null;
68808
69625
  try {
@@ -69222,7 +70039,7 @@ async function assertRegularFile(path2) {
69222
70039
  const file = await (0, import_promises12.lstat)(path2);
69223
70040
  if (file.isSymbolicLink() || !file.isFile()) {
69224
70041
  throw Object.assign(
69225
- new Error(`Refusing non-regular diagnostic source: ${(0, import_node_path29.basename)(path2)}`),
70042
+ new Error(`Refusing non-regular diagnostic source: ${(0, import_node_path31.basename)(path2)}`),
69226
70043
  { diagnosticUnavailable: true }
69227
70044
  );
69228
70045
  }
@@ -69303,30 +70120,30 @@ function recordCollector(state, result) {
69303
70120
  }
69304
70121
  async function resolveOutputPath(requested, input) {
69305
70122
  if (requested) {
69306
- const output2 = (0, import_node_path30.isAbsolute)(requested) ? requested : (0, import_node_path30.resolve)(input.cwd, requested);
69307
- if ((0, import_node_fs24.existsSync)(output2) && !input.overwrite) {
70123
+ const output2 = (0, import_node_path32.isAbsolute)(requested) ? requested : (0, import_node_path32.resolve)(input.cwd, requested);
70124
+ if ((0, import_node_fs26.existsSync)(output2) && !input.overwrite) {
69308
70125
  throw new Error(`Output already exists: ${output2}. Pass --overwrite to replace it.`);
69309
70126
  }
69310
70127
  return output2;
69311
70128
  }
69312
70129
  const stamp = input.now.toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z");
69313
70130
  const base = `okx-a2a-diagnostics-${stamp}.zip`;
69314
- let output = (0, import_node_path30.join)(input.cwd, base);
69315
- for (let suffix = 2; (0, import_node_fs24.existsSync)(output); suffix += 1) {
69316
- output = (0, import_node_path30.join)(input.cwd, `okx-a2a-diagnostics-${stamp}-${suffix}.zip`);
70131
+ let output = (0, import_node_path32.join)(input.cwd, base);
70132
+ for (let suffix = 2; (0, import_node_fs26.existsSync)(output); suffix += 1) {
70133
+ output = (0, import_node_path32.join)(input.cwd, `okx-a2a-diagnostics-${stamp}-${suffix}.zip`);
69317
70134
  }
69318
70135
  return output;
69319
70136
  }
69320
70137
  async function writeArchiveAtomically(outputPath, archive, overwrite) {
69321
- await (0, import_promises13.mkdir)((0, import_node_path30.dirname)(outputPath), { recursive: true });
69322
- const temporaryPath = (0, import_node_path30.join)(
69323
- (0, import_node_path30.dirname)(outputPath),
69324
- `.${(0, import_node_path30.basename)(outputPath)}.${(0, import_node_crypto14.randomUUID)()}.tmp`
70138
+ await (0, import_promises13.mkdir)((0, import_node_path32.dirname)(outputPath), { recursive: true });
70139
+ const temporaryPath = (0, import_node_path32.join)(
70140
+ (0, import_node_path32.dirname)(outputPath),
70141
+ `.${(0, import_node_path32.basename)(outputPath)}.${(0, import_node_crypto16.randomUUID)()}.tmp`
69325
70142
  );
69326
70143
  try {
69327
70144
  await (0, import_promises13.writeFile)(temporaryPath, archive, { flag: "wx", mode: 384 });
69328
70145
  if (overwrite) {
69329
- if ((0, import_node_fs24.existsSync)(outputPath)) {
70146
+ if ((0, import_node_fs26.existsSync)(outputPath)) {
69330
70147
  await (0, import_promises13.rm)(outputPath, { force: true });
69331
70148
  }
69332
70149
  await (0, import_promises13.rename)(temporaryPath, outputPath);
@@ -69340,14 +70157,14 @@ async function writeArchiveAtomically(outputPath, archive, overwrite) {
69340
70157
  }
69341
70158
  }
69342
70159
  function hashDiagnosticFileContent(content) {
69343
- return (0, import_node_crypto14.createHash)("sha256").update(content).digest("hex");
70160
+ return (0, import_node_crypto16.createHash)("sha256").update(content).digest("hex");
69344
70161
  }
69345
70162
  function isUnavailableError(err) {
69346
70163
  return !!err && typeof err === "object" && "diagnosticUnavailable" in err;
69347
70164
  }
69348
70165
 
69349
70166
  // src/logs-export-database.ts
69350
- var import_node_fs25 = require("node:fs");
70167
+ var import_node_fs27 = require("node:fs");
69351
70168
  var PROVIDERS = ["codex", "claude", "openclaw", "hermes"];
69352
70169
  function readSessionSqliteSnapshot(dbPath, options, selectedJobIds) {
69353
70170
  const hasTimeWindow2 = options.fromMs !== void 0 && options.toMs !== void 0;
@@ -69445,7 +70262,7 @@ function readSessionSqliteSnapshot(dbPath, options, selectedJobIds) {
69445
70262
  };
69446
70263
  }
69447
70264
  function readSqliteRows(dbPath, sql, params = []) {
69448
- if (!(0, import_node_fs25.existsSync)(dbPath)) {
70265
+ if (!(0, import_node_fs27.existsSync)(dbPath)) {
69449
70266
  throw unavailable(`SQLite database not found: ${dbPath}`);
69450
70267
  }
69451
70268
  const { DatabaseSync: DatabaseSync4 } = loadSqlite4();
@@ -69503,15 +70320,15 @@ function unavailable(message) {
69503
70320
  }
69504
70321
 
69505
70322
  // src/logs-export-provider.ts
69506
- var import_node_child_process9 = require("node:child_process");
70323
+ var import_node_child_process10 = require("node:child_process");
69507
70324
  var import_node_os12 = require("node:os");
69508
- var import_node_path31 = require("node:path");
70325
+ var import_node_path33 = require("node:path");
69509
70326
  var PROVIDERS2 = ["codex", "claude", "openclaw", "hermes"];
69510
70327
  function providerConfigCandidates(provider, taskHome2) {
69511
70328
  if (provider === "codex") {
69512
70329
  return [
69513
70330
  {
69514
- path: (0, import_node_path31.join)(process.env.CODEX_HOME ?? (0, import_node_path31.join)((0, import_node_os12.homedir)(), ".codex"), "config.toml"),
70331
+ path: (0, import_node_path33.join)(process.env.CODEX_HOME ?? (0, import_node_path33.join)((0, import_node_os12.homedir)(), ".codex"), "config.toml"),
69515
70332
  archiveName: "config.redacted.toml"
69516
70333
  }
69517
70334
  ];
@@ -69519,11 +70336,11 @@ function providerConfigCandidates(provider, taskHome2) {
69519
70336
  if (provider === "claude") {
69520
70337
  return [
69521
70338
  {
69522
- path: (0, import_node_path31.join)((0, import_node_os12.homedir)(), ".claude", "settings.json"),
70339
+ path: (0, import_node_path33.join)((0, import_node_os12.homedir)(), ".claude", "settings.json"),
69523
70340
  archiveName: "settings.redacted.json"
69524
70341
  },
69525
70342
  {
69526
- path: (0, import_node_path31.join)(process.cwd(), ".claude", "settings.json"),
70343
+ path: (0, import_node_path33.join)(process.cwd(), ".claude", "settings.json"),
69527
70344
  archiveName: "project-settings.redacted.json"
69528
70345
  }
69529
70346
  ];
@@ -69532,28 +70349,28 @@ function providerConfigCandidates(provider, taskHome2) {
69532
70349
  const openClawStateDir = resolveOpenClawStateDir();
69533
70350
  return [
69534
70351
  {
69535
- path: (0, import_node_path31.join)(openClawStateDir, "openclaw.json"),
70352
+ path: (0, import_node_path33.join)(openClawStateDir, "openclaw.json"),
69536
70353
  archiveName: "config.redacted.json"
69537
70354
  },
69538
70355
  {
69539
- path: (0, import_node_path31.join)(taskHome2, "xmtp", "openclaw-gateway.json"),
70356
+ path: (0, import_node_path33.join)(taskHome2, "xmtp", "openclaw-gateway.json"),
69540
70357
  archiveName: "gateway-config.redacted.json"
69541
70358
  }
69542
70359
  ];
69543
70360
  }
69544
70361
  return [
69545
70362
  {
69546
- path: (0, import_node_path31.join)(resolveHermesHome(), "config.yaml"),
70363
+ path: (0, import_node_path33.join)(resolveHermesHome(), "config.yaml"),
69547
70364
  archiveName: "config.redacted.yaml"
69548
70365
  }
69549
70366
  ];
69550
70367
  }
69551
70368
  function resolveOpenClawStateDir() {
69552
70369
  const configured = process.env.OPENCLAW_STATE_DIR?.trim() || process.env.OPENCLAW_HOME?.trim();
69553
- return (0, import_node_path31.resolve)(configured || (0, import_node_path31.join)((0, import_node_os12.homedir)(), ".openclaw"));
70370
+ return (0, import_node_path33.resolve)(configured || (0, import_node_path33.join)((0, import_node_os12.homedir)(), ".openclaw"));
69554
70371
  }
69555
70372
  function resolveHermesHome() {
69556
- return (0, import_node_path31.resolve)(process.env.HERMES_HOME?.trim() || (0, import_node_path31.join)((0, import_node_os12.homedir)(), ".hermes"));
70373
+ return (0, import_node_path33.resolve)(process.env.HERMES_HOME?.trim() || (0, import_node_path33.join)((0, import_node_os12.homedir)(), ".hermes"));
69557
70374
  }
69558
70375
  function providerEnvironment(provider) {
69559
70376
  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_"];
@@ -69570,7 +70387,7 @@ function safeCommandLabel(command) {
69570
70387
  return "";
69571
70388
  }
69572
70389
  const executable = trimmed.match(/^"([^"]+)"/)?.[1] ?? trimmed.split(/\s+/, 1)[0];
69573
- return (0, import_node_path31.basename)(executable);
70390
+ return (0, import_node_path33.basename)(executable);
69574
70391
  }
69575
70392
  function resolveProvider(requested, binding, fallback = null) {
69576
70393
  if (requested !== "auto") {
@@ -69583,7 +70400,7 @@ function resolveProviderCommand(provider, storedCommand) {
69583
70400
  return override || storedCommand || provider;
69584
70401
  }
69585
70402
  function probeVersion(command) {
69586
- const result = (0, import_node_child_process9.spawnSync)(command, ["--version"], {
70403
+ const result = (0, import_node_child_process10.spawnSync)(command, ["--version"], {
69587
70404
  encoding: "utf8",
69588
70405
  timeout: 1e4,
69589
70406
  shell: process.platform === "win32"
@@ -69600,10 +70417,10 @@ function isProvider2(value) {
69600
70417
  }
69601
70418
 
69602
70419
  // src/logs-export-utils.ts
69603
- var import_node_crypto15 = require("node:crypto");
69604
- var import_node_fs26 = require("node:fs");
70420
+ var import_node_crypto17 = require("node:crypto");
70421
+ var import_node_fs28 = require("node:fs");
69605
70422
  var import_promises14 = require("node:fs/promises");
69606
- var import_node_path32 = require("node:path");
70423
+ var import_node_path34 = require("node:path");
69607
70424
  var MAX_JSON_FILE_BYTES = 20 * 1024 * 1024;
69608
70425
  var STRONG_CORRELATION_KEYS = /* @__PURE__ */ new Set([
69609
70426
  "approvalid",
@@ -69737,14 +70554,14 @@ async function readJsonObject(path2) {
69737
70554
  async function assertRegularFile2(path2) {
69738
70555
  const file = await (0, import_promises14.lstat)(path2);
69739
70556
  if (file.isSymbolicLink() || !file.isFile()) {
69740
- throw unavailable2(`Refusing non-regular diagnostic source: ${(0, import_node_path32.basename)(path2)}`);
70557
+ throw unavailable2(`Refusing non-regular diagnostic source: ${(0, import_node_path34.basename)(path2)}`);
69741
70558
  }
69742
70559
  return file;
69743
70560
  }
69744
70561
  async function inspectRegularFile(path2) {
69745
70562
  const file = await assertRegularFile2(path2);
69746
- const hash2 = (0, import_node_crypto15.createHash)("sha256");
69747
- for await (const chunk of (0, import_node_fs26.createReadStream)(path2)) {
70563
+ const hash2 = (0, import_node_crypto17.createHash)("sha256");
70564
+ for await (const chunk of (0, import_node_fs28.createReadStream)(path2)) {
69748
70565
  hash2.update(chunk);
69749
70566
  }
69750
70567
  return {
@@ -69895,7 +70712,7 @@ function parseLogsExportArgs(args, input = {}) {
69895
70712
  async function exportDiagnosticLogs(options) {
69896
70713
  validateOptions(options);
69897
70714
  const paths = diagnosticPaths(options.taskHome);
69898
- const cwd = (0, import_node_path33.resolve)(options.cwd ?? process.cwd());
70715
+ const cwd = (0, import_node_path35.resolve)(options.cwd ?? process.cwd());
69899
70716
  const now = options.now ?? /* @__PURE__ */ new Date();
69900
70717
  const outputPath = await resolveOutputPath(options.outputPath, {
69901
70718
  cwd,
@@ -69989,14 +70806,14 @@ async function exportDiagnosticLogs(options) {
69989
70806
  scope,
69990
70807
  jobId: options.jobId,
69991
70808
  taskHome: {
69992
- basename: (0, import_node_path33.basename)(paths.taskHome),
70809
+ basename: (0, import_node_path35.basename)(paths.taskHome),
69993
70810
  explicitlyConfigured: !!options.taskHome,
69994
70811
  absolutePathCollected: false
69995
70812
  },
69996
70813
  node: process.version,
69997
70814
  platform: process.platform,
69998
70815
  arch: process.arch,
69999
- packageVersion: true ? "0.2.9" : "unknown",
70816
+ packageVersion: true ? "0.2.10-beta-98689bff7a-260826143751" : "unknown",
70000
70817
  sensitiveContentIncluded: options.includeSensitiveContent,
70001
70818
  listenerAndLlmContentIncluded: true,
70002
70819
  credentialsAlwaysRedacted: true,
@@ -70079,7 +70896,7 @@ async function collectJobMetadata(state, paths, options) {
70079
70896
  correlationIds.strong.add(options.jobId);
70080
70897
  }
70081
70898
  for (const name of names.filter((item) => item.endsWith(".json")).sort()) {
70082
- const path2 = (0, import_node_path33.join)(paths.jobsDir, name);
70899
+ const path2 = (0, import_node_path35.join)(paths.jobsDir, name);
70083
70900
  let parsed;
70084
70901
  try {
70085
70902
  parsed = await readJsonObject(path2);
@@ -70150,7 +70967,7 @@ async function collectJobMetadata(state, paths, options) {
70150
70967
  }
70151
70968
  async function collectSessionSnapshot(state, paths, options, selectedJobIds) {
70152
70969
  return runCollector(state, "a2a-session-store", async () => {
70153
- const dbPath = (0, import_node_path33.join)(paths.sqliteDir, "session-store.sqlite");
70970
+ const dbPath = (0, import_node_path35.join)(paths.sqliteDir, "session-store.sqlite");
70154
70971
  const snapshot = readSessionSqliteSnapshot(dbPath, options, selectedJobIds);
70155
70972
  addJsonEntry(state, "a2a/sessions.json", {
70156
70973
  sessions: snapshot.sessions,
@@ -70182,7 +70999,7 @@ async function collectA2aLogs(state, paths, options, sessionKeys, correlationIds
70182
70999
  const filterNotes = [];
70183
71000
  for (const [sourcePath, archivePath] of [
70184
71001
  [paths.listenerLogPath, "a2a/listener.log"],
70185
- [(0, import_node_path33.join)(paths.logsDir, "llm.log"), "a2a/llm.log"]
71002
+ [(0, import_node_path35.join)(paths.logsDir, "llm.log"), "a2a/llm.log"]
70186
71003
  ]) {
70187
71004
  const output = await readFilteredLog(
70188
71005
  sourcePath,
@@ -70195,7 +71012,7 @@ async function collectA2aLogs(state, paths, options, sessionKeys, correlationIds
70195
71012
  if (!output?.text) {
70196
71013
  if (output?.excludedNoTimestamp) {
70197
71014
  filterNotes.push(
70198
- `${(0, import_node_path33.basename)(sourcePath)} excluded ${output.excludedNoTimestamp} timestamp-less records`
71015
+ `${(0, import_node_path35.basename)(sourcePath)} excluded ${output.excludedNoTimestamp} timestamp-less records`
70199
71016
  );
70200
71017
  }
70201
71018
  continue;
@@ -70204,11 +71021,11 @@ async function collectA2aLogs(state, paths, options, sessionKeys, correlationIds
70204
71021
  collected.push(archivePath);
70205
71022
  if (output.excludedNoTimestamp) {
70206
71023
  filterNotes.push(
70207
- `${(0, import_node_path33.basename)(sourcePath)} excluded ${output.excludedNoTimestamp} timestamp-less records`
71024
+ `${(0, import_node_path35.basename)(sourcePath)} excluded ${output.excludedNoTimestamp} timestamp-less records`
70208
71025
  );
70209
71026
  }
70210
71027
  if (output.truncated) {
70211
- filterNotes.push(`${(0, import_node_path33.basename)(sourcePath)} reached the configured size limit`);
71028
+ filterNotes.push(`${(0, import_node_path35.basename)(sourcePath)} reached the configured size limit`);
70212
71029
  }
70213
71030
  }
70214
71031
  for (const name of await safeReadDir(paths.logsDir)) {
@@ -70223,7 +71040,7 @@ async function collectA2aLogs(state, paths, options, sessionKeys, correlationIds
70223
71040
  if (!matchesDirectJob && !matchesPersistedSession && !matchesJobSessionFilename) {
70224
71041
  continue;
70225
71042
  }
70226
- const sourcePath = (0, import_node_path33.join)(paths.logsDir, name);
71043
+ const sourcePath = (0, import_node_path35.join)(paths.logsDir, name);
70227
71044
  let info;
70228
71045
  let filtered;
70229
71046
  try {
@@ -70296,7 +71113,7 @@ async function collectA2aLogs(state, paths, options, sessionKeys, correlationIds
70296
71113
  }
70297
71114
  async function collectCommands(state, paths, options) {
70298
71115
  return runCollector(state, "a2a-command-store", async () => {
70299
- const dbPath = (0, import_node_path33.join)(paths.sqliteDir, "command-store.sqlite");
71116
+ const dbPath = (0, import_node_path35.join)(paths.sqliteDir, "command-store.sqlite");
70300
71117
  const hasWindow = hasTimeWindow(options);
70301
71118
  const rows = readSqliteRows(dbPath, `
70302
71119
  SELECT id, type, status, command_json, result_json,
@@ -70337,8 +71154,8 @@ async function collectCommands(state, paths, options) {
70337
71154
  }
70338
71155
  async function collectOnchainAudit(state, options, correlationIds) {
70339
71156
  await runCollector(state, "onchainos-audit", async () => {
70340
- 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");
70341
- const auditPath = (0, import_node_path33.join)(onchainHome, "audit.jsonl");
71157
+ const onchainHome = process.env.ONCHAINOS_HOME?.trim() ? (0, import_node_path35.resolve)(process.env.ONCHAINOS_HOME) : (0, import_node_path35.join)((0, import_node_os13.homedir)(), ".onchainos");
71158
+ const auditPath = (0, import_node_path35.join)(onchainHome, "audit.jsonl");
70342
71159
  const output = await readFilteredLog(
70343
71160
  auditPath,
70344
71161
  options,
@@ -70413,7 +71230,7 @@ async function collectProviderDiagnostics(state, provider, storedCommand, option
70413
71230
  const configCandidates = providerConfigCandidates(provider, paths.taskHome);
70414
71231
  const configNotes = [];
70415
71232
  for (const candidate of configCandidates) {
70416
- if (!(0, import_node_fs27.existsSync)(candidate.path)) {
71233
+ if (!(0, import_node_fs29.existsSync)(candidate.path)) {
70417
71234
  continue;
70418
71235
  }
70419
71236
  let info;
@@ -70453,7 +71270,7 @@ async function collectOpenClawSessionStore(state, options) {
70453
71270
  const jobId = options.jobId;
70454
71271
  const filterLabel = jobId ? "exact-job" : "time-window";
70455
71272
  await runCollector(state, "openclaw-session-store", async () => {
70456
- const agentsDir = (0, import_node_path33.join)(resolveOpenClawStateDir(), "agents");
71273
+ const agentsDir = (0, import_node_path35.join)(resolveOpenClawStateDir(), "agents");
70457
71274
  const allAgentNames = (await safeReadDir(agentsDir)).sort();
70458
71275
  if (allAgentNames.length === 0) {
70459
71276
  throw unavailable2("No OpenClaw agent session stores were found");
@@ -70462,7 +71279,7 @@ async function collectOpenClawSessionStore(state, options) {
70462
71279
  let skippedSources = 0;
70463
71280
  let discoveryLimited = allAgentNames.length > MAX_OPENCLAW_AGENTS;
70464
71281
  for (const agentId of allAgentNames.slice(0, MAX_OPENCLAW_AGENTS)) {
70465
- const sessionsDir = (0, import_node_path33.join)(agentsDir, agentId, "sessions");
71282
+ const sessionsDir = (0, import_node_path35.join)(agentsDir, agentId, "sessions");
70466
71283
  try {
70467
71284
  const info = await (0, import_promises15.lstat)(sessionsDir);
70468
71285
  if (info.isSymbolicLink() || !info.isDirectory()) {
@@ -70478,7 +71295,7 @@ async function collectOpenClawSessionStore(state, options) {
70478
71295
  try {
70479
71296
  for (const name of await safeReadDir(sessionsDir)) {
70480
71297
  if (isOpenClawSessionLogName(name)) {
70481
- candidates.push({ agentId, path: (0, import_node_path33.join)(sessionsDir, name) });
71298
+ candidates.push({ agentId, path: (0, import_node_path35.join)(sessionsDir, name) });
70482
71299
  }
70483
71300
  }
70484
71301
  } catch {
@@ -70516,7 +71333,7 @@ async function collectOpenClawSessionStore(state, options) {
70516
71333
  if (!output?.text || output.matchedRecords === 0) {
70517
71334
  continue;
70518
71335
  }
70519
- const archivePath = `providers/openclaw/sessions/${safeArchiveName(candidate.agentId)}/${safeArchiveName((0, import_node_path33.basename)(candidate.path))}`;
71336
+ const archivePath = `providers/openclaw/sessions/${safeArchiveName(candidate.agentId)}/${safeArchiveName((0, import_node_path35.basename)(candidate.path))}`;
70520
71337
  addTextEntry(state, archivePath, output.text);
70521
71338
  files.push(archivePath);
70522
71339
  matchedRecords += output.matchedRecords;
@@ -70565,11 +71382,11 @@ async function collectGatewayLogs(state, provider, paths, options, correlationId
70565
71382
  let candidates;
70566
71383
  if (provider === "openclaw") {
70567
71384
  candidates = [
70568
- (0, import_node_path33.join)(paths.logsDir, "gateway-openclaw.jsonl"),
70569
- (0, import_node_path33.join)(resolveOpenClawStateDir(), "logs", "gateway.log")
71385
+ (0, import_node_path35.join)(paths.logsDir, "gateway-openclaw.jsonl"),
71386
+ (0, import_node_path35.join)(resolveOpenClawStateDir(), "logs", "gateway.log")
70570
71387
  ];
70571
71388
  } else {
70572
- const hermesLogsDir = (0, import_node_path33.join)(resolveHermesHome(), "logs");
71389
+ const hermesLogsDir = (0, import_node_path35.join)(resolveHermesHome(), "logs");
70573
71390
  let rotatedNames = [];
70574
71391
  try {
70575
71392
  rotatedNames = (await safeReadDir(hermesLogsDir)).filter(isHermesRotatedLogName).sort();
@@ -70583,12 +71400,12 @@ async function collectGatewayLogs(state, provider, paths, options, correlationId
70583
71400
  rotatedNames.length = MAX_HERMES_ROTATED_LOG_FILES;
70584
71401
  }
70585
71402
  candidates = [
70586
- (0, import_node_path33.join)(paths.logsDir, "gateway-hermes.jsonl"),
70587
- (0, import_node_path33.join)(hermesLogsDir, "agent.log"),
70588
- (0, import_node_path33.join)(hermesLogsDir, "gateway.log"),
70589
- (0, import_node_path33.join)(hermesLogsDir, "error.log"),
70590
- (0, import_node_path33.join)(hermesLogsDir, "errors.log"),
70591
- ...rotatedNames.map((name) => (0, import_node_path33.join)(hermesLogsDir, name)),
71403
+ (0, import_node_path35.join)(paths.logsDir, "gateway-hermes.jsonl"),
71404
+ (0, import_node_path35.join)(hermesLogsDir, "agent.log"),
71405
+ (0, import_node_path35.join)(hermesLogsDir, "gateway.log"),
71406
+ (0, import_node_path35.join)(hermesLogsDir, "error.log"),
71407
+ (0, import_node_path35.join)(hermesLogsDir, "errors.log"),
71408
+ ...rotatedNames.map((name) => (0, import_node_path35.join)(hermesLogsDir, name)),
70592
71409
  "/tmp/hermes-gateway.log"
70593
71410
  ];
70594
71411
  }
@@ -70610,7 +71427,7 @@ async function collectGatewayLogs(state, provider, paths, options, correlationId
70610
71427
  if (!output?.text) {
70611
71428
  continue;
70612
71429
  }
70613
- const archivePath = `providers/${provider}/gateway/${safeArchiveName((0, import_node_path33.basename)(candidate))}`;
71430
+ const archivePath = `providers/${provider}/gateway/${safeArchiveName((0, import_node_path35.basename)(candidate))}`;
70614
71431
  addTextEntry(state, archivePath, output.text);
70615
71432
  files.push(archivePath);
70616
71433
  }
@@ -70641,10 +71458,10 @@ async function collectGatewayLogs(state, provider, paths, options, correlationId
70641
71458
  async function collectDoctorSnapshot(state, options) {
70642
71459
  await runCollector(state, "doctor", async () => {
70643
71460
  const cliPath = process.argv[1];
70644
- if (!cliPath || !(0, import_node_fs27.existsSync)(cliPath)) {
71461
+ if (!cliPath || !(0, import_node_fs29.existsSync)(cliPath)) {
70645
71462
  throw unavailable2("Unable to resolve the running okx-a2a CLI path");
70646
71463
  }
70647
- const result = (0, import_node_child_process10.spawnSync)(process.execPath, [
71464
+ const result = (0, import_node_child_process11.spawnSync)(process.execPath, [
70648
71465
  cliPath,
70649
71466
  "doctor",
70650
71467
  "--json",
@@ -70783,13 +71600,13 @@ function formatEvidence(value, unavailableReason) {
70783
71600
  return unavailableReason ? `unknown (${unavailableReason})` : "unknown";
70784
71601
  }
70785
71602
  function diagnosticPaths(taskHome2) {
70786
- const home = (0, import_node_path33.resolve)(taskHome2 ?? resolveTaskHome());
71603
+ const home = (0, import_node_path35.resolve)(taskHome2 ?? resolveTaskHome());
70787
71604
  return {
70788
71605
  taskHome: home,
70789
- jobsDir: (0, import_node_path33.join)(home, "jobs"),
70790
- logsDir: (0, import_node_path33.join)(home, "logs"),
70791
- sqliteDir: (0, import_node_path33.join)(home, "sqlite"),
70792
- listenerLogPath: (0, import_node_path33.join)(home, "logs", "listener.log")
71606
+ jobsDir: (0, import_node_path35.join)(home, "jobs"),
71607
+ logsDir: (0, import_node_path35.join)(home, "logs"),
71608
+ sqliteDir: (0, import_node_path35.join)(home, "sqlite"),
71609
+ listenerLogPath: (0, import_node_path35.join)(home, "logs", "listener.log")
70793
71610
  };
70794
71611
  }
70795
71612
  function validateOptions(options) {
@@ -70860,7 +71677,7 @@ init_ai_provider();
70860
71677
  init_update_cli();
70861
71678
 
70862
71679
  // src/doctor-cli.ts
70863
- var import_node_path34 = require("node:path");
71680
+ var import_node_path36 = require("node:path");
70864
71681
  init_log();
70865
71682
  init_win_compat();
70866
71683
  init_ai_command();
@@ -71249,7 +72066,7 @@ var windowsNativeLauncherChecker = {
71249
72066
  command: "okx-a2a doctor --fix"
71250
72067
  },
71251
72068
  data: {
71252
- appDataNpm: ctx.env.APPDATA ? (0, import_node_path34.join)(ctx.env.APPDATA, "npm") : null
72069
+ appDataNpm: ctx.env.APPDATA ? (0, import_node_path36.join)(ctx.env.APPDATA, "npm") : null
71253
72070
  }
71254
72071
  };
71255
72072
  },
@@ -71878,7 +72695,7 @@ async function runDoctor(options = {}) {
71878
72695
  platform: options.platform ?? process.platform,
71879
72696
  env: options.env ?? process.env,
71880
72697
  target: options.target ?? resolveDoctorTarget(options.env ?? process.env),
71881
- cliVersion: options.cliVersion ?? (true ? "0.2.9" : "0.0.0"),
72698
+ cliVersion: options.cliVersion ?? (true ? "0.2.10-beta-98689bff7a-260826143751" : "0.0.0"),
71882
72699
  fixMode: options.fix === true,
71883
72700
  nonInteractive: options.nonInteractive === true,
71884
72701
  packageChanged: false,
@@ -72132,9 +72949,12 @@ init_autostart_windows();
72132
72949
  NATIVE_LAUNCHER_EXE_NAME,
72133
72950
  OPENCLAW_GATEWAY_ROUTE_GROUP_ID,
72134
72951
  ProviderNotReadyError,
72952
+ SIGNAL_PAYLOAD_TYPE,
72953
+ SIGNAL_SPEC_VERSION,
72135
72954
  SYSTEM_NOTIFICATION_SESSION_KEY,
72136
72955
  SessionBusyTracker,
72137
72956
  SessionStore,
72957
+ SignalTradingBuyerRuntime,
72138
72958
  SqliteOutboundBehavior,
72139
72959
  TASK_NAME,
72140
72960
  TaskMessageStore,
@@ -72175,6 +72995,7 @@ init_autostart_windows();
72175
72995
  buildLaunchdPlist,
72176
72996
  buildLauncherEntryJs,
72177
72997
  buildMessageEligibleArgs,
72998
+ buildPolymarketExecutionPlan,
72178
72999
  buildSchtasksCreateArgs,
72179
73000
  buildSchtasksDeleteArgs,
72180
73001
  buildSchtasksEndArgs,
@@ -72183,6 +73004,7 @@ init_autostart_windows();
72183
73004
  buildSeaConfig,
72184
73005
  buildServicePath,
72185
73006
  buildSessionKey,
73007
+ buildSignalEnvelopePayload,
72186
73008
  buildSystemMessageNotice,
72187
73009
  buildSystemStoredMessage,
72188
73010
  buildSystemdUserService,
@@ -72206,6 +73028,7 @@ init_autostart_windows();
72206
73028
  collectCodexAppBundledCandidates,
72207
73029
  collectCodexCommandCandidates,
72208
73030
  commandExists,
73031
+ comparePositiveDecimals,
72209
73032
  createAiToolFailureTracker,
72210
73033
  createFileMessageHandler,
72211
73034
  createOutboundBehavior,
@@ -72226,6 +73049,7 @@ init_autostart_windows();
72226
73049
  exportDiagnosticLogs,
72227
73050
  extractAiSessionId,
72228
73051
  extractDirectToUserNotification,
73052
+ extractSignalEnvelopePayload,
72229
73053
  extractXmtpSentAtMs,
72230
73054
  findWindowsNativeOkxA2aExe,
72231
73055
  followFile,
@@ -72237,10 +73061,12 @@ init_autostart_windows();
72237
73061
  getSessionBusyTracker,
72238
73062
  handleCapabilitiesCommand,
72239
73063
  handleDoctorCommand,
73064
+ handleSignalPublishCommand,
72240
73065
  handleXmtpDebugCommand,
72241
73066
  handleXmtpSendCommand,
72242
73067
  handleXmtpTestCommand,
72243
73068
  hasAiRuntimeMarker,
73069
+ hasSignalEnvelopePayload,
72244
73070
  hashDiagnosticFileContent,
72245
73071
  heartbeatUserAttentionWatcher,
72246
73072
  hermesConfigEnablesOkxA2a,
@@ -72266,6 +73092,7 @@ init_autostart_windows();
72266
73092
  killProcessTree,
72267
73093
  launchdPlistHasCurrentRestartPolicy,
72268
73094
  listAllAgentsWithMetadata,
73095
+ loadSignalTradingConfig,
72269
73096
  logWinCompat,
72270
73097
  logXmtpMessageSent,
72271
73098
  maybeRecommendOnchainosUpgrade,
@@ -72282,6 +73109,8 @@ init_autostart_windows();
72282
73109
  parseLogsExportArgs,
72283
73110
  parseOnchainosVersionOutput,
72284
73111
  parsePluginYamlVersion,
73112
+ parseSignalTradingConfig,
73113
+ parseTradingSignalV1,
72285
73114
  parseWalletLoginStatus,
72286
73115
  parseWindowsParentProcessJson,
72287
73116
  performRuntimeSwitch,
@@ -72331,6 +73160,8 @@ init_autostart_windows();
72331
73160
  resolveOpenClawGatewayRoute,
72332
73161
  resolveOpenClawGatewayRoutes,
72333
73162
  resolveProviderCommandWithSelfHeal,
73163
+ resolveSignalTradingConfigPath,
73164
+ resolveSignalTradingDir,
72334
73165
  resolveSystemNotificationTargets,
72335
73166
  resolveSystemdAutostartPaths,
72336
73167
  resolveTaskConfigPath,