@pionex/pionex-ai-kit 0.2.51 → 0.2.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -14,7 +14,8 @@ npm install -g @pionex/pionex-ai-kit
14
14
  - **pionex-ai-kit setup** — Register MCP servers for supported clients.
15
15
  - **pionex-ai-kit help** — Show help.
16
16
  - **pionex-trade-cli market ...** — Public market data commands.
17
- - **pionex-trade-cli account ...** — Account balance commands (`balance`, `balance_full`).
17
+ - **pionex-trade-cli account ...** — Account balance command (`balance`).
18
+ - **pionex-trade-cli wallet ...** — Wallet commands (`balance_full`).
18
19
  - **pionex-trade-cli orders ...** — Spot order lifecycle commands.
19
20
  - **pionex-trade-cli bot futures_grid ...** — Futures grid bot lifecycle commands (`get/create/adjust_params/reduce/cancel`).
20
21
  - **pionex-trade-cli bot spot_grid ...** — Spot grid bot lifecycle commands (`get/get_ai_strategy/create/adjust_params/invest_in/cancel/profit`).
@@ -863,7 +863,8 @@ var CLIENT_NAMES = {
863
863
  windsurf: "Windsurf",
864
864
  vscode: "VS Code",
865
865
  "claude-code": "Claude Code CLI",
866
- openclaw: "OpenClaw (mcporter)"
866
+ openclaw: "OpenClaw (mcporter)",
867
+ codex: "OpenAI Codex CLI"
867
868
  };
868
869
  var SUPPORTED_CLIENTS = Object.keys(CLIENT_NAMES);
869
870
  function appData() {
@@ -915,6 +916,8 @@ function getConfigPath(client) {
915
916
  return null;
916
917
  case "openclaw":
917
918
  return path.join(home, ".openclaw", "workspace", "config", "mcporter.json");
919
+ case "codex":
920
+ return path.join(home, ".codex", "config.yaml");
918
921
  }
919
922
  }
920
923
  var NPX_PACKAGE = "@pionex/pionex-trade-mcp";
@@ -922,6 +925,9 @@ function buildEntry(client) {
922
925
  if (client === "vscode") {
923
926
  return { type: "stdio", command: "npx", args: ["-y", NPX_PACKAGE] };
924
927
  }
928
+ if (client === "codex") {
929
+ return { command: "npx", args: ["-y", NPX_PACKAGE] };
930
+ }
925
931
  return { command: "npx", args: ["-y", NPX_PACKAGE] };
926
932
  }
927
933
  function mergeJsonConfig(configPath, serverName, entry) {
@@ -942,6 +948,42 @@ function mergeJsonConfig(configPath, serverName, entry) {
942
948
  data.mcpServers[serverName] = entry;
943
949
  fs.writeFileSync(configPath, JSON.stringify(data, null, 2) + "\n", "utf-8");
944
950
  }
951
+ function mergeCodexYaml(configPath, serverName, entry) {
952
+ const dir = path.dirname(configPath);
953
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
954
+ const args = entry.args;
955
+ const argsYaml = args.map((a) => ` - "${a}"`).join("\n");
956
+ const serverBlock = ` ${serverName}:
957
+ command: "${entry.command}"
958
+ args:
959
+ ` + argsYaml;
960
+ if (!fs.existsSync(configPath)) {
961
+ const content = `mcpServers:
962
+ ${serverBlock}
963
+ `;
964
+ fs.writeFileSync(configPath, content, "utf-8");
965
+ return;
966
+ }
967
+ const raw = fs.readFileSync(configPath, "utf-8");
968
+ const serverEntryRegex = new RegExp(
969
+ `( ${serverName}:\\n(?: [^\\n]*\\n| [^\\n]*\\n)*)`,
970
+ "g"
971
+ );
972
+ if (serverEntryRegex.test(raw)) {
973
+ fs.writeFileSync(configPath, raw.replace(serverEntryRegex, serverBlock + "\n"), "utf-8");
974
+ return;
975
+ }
976
+ if (raw.includes("mcpServers:")) {
977
+ const updated = raw.replace("mcpServers:", `mcpServers:
978
+ ${serverBlock}`);
979
+ fs.writeFileSync(configPath, updated, "utf-8");
980
+ return;
981
+ }
982
+ fs.writeFileSync(configPath, raw.trimEnd() + `
983
+ mcpServers:
984
+ ${serverBlock}
985
+ `, "utf-8");
986
+ }
945
987
  function runSetup(options) {
946
988
  const { client } = options;
947
989
  const name = CLIENT_NAMES[client];
@@ -972,7 +1014,11 @@ function runSetup(options) {
972
1014
  throw new Error(`${name} is not supported on this platform`);
973
1015
  }
974
1016
  const entry = buildEntry(client);
975
- mergeJsonConfig(configPath, serverName, entry);
1017
+ if (client === "codex") {
1018
+ mergeCodexYaml(configPath, serverName, entry);
1019
+ } else {
1020
+ mergeJsonConfig(configPath, serverName, entry);
1021
+ }
976
1022
  process.stdout.write(
977
1023
  `\u2713 Configured ${name}
978
1024
  ${configPath}
@@ -981,8 +1027,8 @@ function runSetup(options) {
981
1027
  );
982
1028
  }
983
1029
  var PIONEX_API_DEFAULT_BASE_URL = "https://api.pionex.com";
984
- var MODULES = ["market", "account", "orders", "bot", "earn_dual"];
985
- var DEFAULT_MODULES = ["market", "account", "orders", "bot", "earn_dual"];
1030
+ var MODULES = ["market", "account", "wallet", "orders", "bot", "earn_dual"];
1031
+ var DEFAULT_MODULES = ["market", "account", "wallet", "orders", "bot", "earn_dual"];
986
1032
  var ConfigError = class extends Error {
987
1033
  suggestion;
988
1034
  constructor(message, suggestion) {
@@ -1319,10 +1365,14 @@ function registerAccountTools() {
1319
1365
  async handler(_args, { client }) {
1320
1366
  return (await client.signedGet("/api/v1/account/balances")).data;
1321
1367
  }
1322
- },
1368
+ }
1369
+ ];
1370
+ }
1371
+ function registerWalletTools() {
1372
+ return [
1323
1373
  {
1324
- name: "pionex_account_get_balance_full",
1325
- module: "account",
1374
+ name: "pionex_wallet_get_balance_full",
1375
+ module: "wallet",
1326
1376
  isWrite: false,
1327
1377
  description: "Query full account balance overview including spot (Bot Account) and futures (Trader Account), with per-coin price info and total USDT/BTC valuations. Requires authentication.",
1328
1378
  inputSchema: {
@@ -3015,7 +3065,7 @@ function registerEarnDualTools() {
3015
3065
  ];
3016
3066
  }
3017
3067
  function allToolSpecs() {
3018
- return [...registerMarketTools(), ...registerAccountTools(), ...registerOrdersTools(), ...registerBotTools(), ...registerEarnDualTools()];
3068
+ return [...registerMarketTools(), ...registerAccountTools(), ...registerWalletTools(), ...registerOrdersTools(), ...registerBotTools(), ...registerEarnDualTools()];
3019
3069
  }
3020
3070
  function createToolRunner(client, config) {
3021
3071
  const fullConfig = { ...config, modules: [...MODULES] };
@@ -3122,4 +3172,4 @@ smol-toml/dist/index.js:
3122
3172
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3123
3173
  *)
3124
3174
  */
3125
- //# sourceMappingURL=chunk-O45XCZNU.js.map
3175
+ //# sourceMappingURL=chunk-P3F7NIBO.js.map