@taptap/instant-games-open-mcp 1.23.5 → 1.23.6

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/dist/maker.js CHANGED
@@ -30467,7 +30467,7 @@ function getBundledSkillSourceDir(skillName) {
30467
30467
  }
30468
30468
 
30469
30469
  // src/maker/server/mcp.ts
30470
- var VERSION = true ? "1.23.5" : "dev";
30470
+ var VERSION = true ? "1.23.6" : "dev";
30471
30471
  var DEFAULT_PROXY_PACKAGE = "@taptap/instant-games-open-mcp@1.22.0";
30472
30472
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
30473
30473
  var LONG_OPERATION_HEARTBEAT_MS = 3 * 60 * 1e3;
@@ -31977,12 +31977,9 @@ function mergeJsonMcpConfig(configPath, options) {
31977
31977
  `, "utf8");
31978
31978
  }
31979
31979
  function mergeCodexMcpConfig(configPath, options) {
31980
- backupIfExists(configPath);
31980
+ const backupPath = backupIfExists(configPath);
31981
31981
  const existing = fs7.existsSync(configPath) ? fs7.readFileSync(configPath, "utf8") : "";
31982
- const sectionPattern = new RegExp(
31983
- `\\n?\\[mcp_servers\\."${escapeRegExp2(options.mcpName)}"(?:\\.[^\\]]+)?\\][\\s\\S]*?(?=\\n\\[(?!mcp_servers\\."${escapeRegExp2(options.mcpName)}"(?:\\.|\\]))|$)`,
31984
- "g"
31985
- );
31982
+ const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
31986
31983
  const withoutOld = existing.replace(sectionPattern, "").trimEnd();
31987
31984
  const command = getNpxCommand();
31988
31985
  const section = [
@@ -31996,6 +31993,56 @@ function mergeCodexMcpConfig(configPath, options) {
31996
31993
  ].join("\n");
31997
31994
  fs7.mkdirSync(path8.dirname(configPath), { recursive: true });
31998
31995
  fs7.writeFileSync(configPath, [withoutOld, section].filter(Boolean).join("\n\n"), "utf8");
31996
+ const updated = fs7.readFileSync(configPath, "utf8");
31997
+ const duplicates = findCodexMcpTableDuplicates(updated, options.mcpName);
31998
+ if (duplicates.length > 0) {
31999
+ restoreBackup(configPath, backupPath);
32000
+ throw new Error(
32001
+ `Codex MCP config update would create duplicate table(s): ${duplicates.join(
32002
+ ", "
32003
+ )}. Restored previous config.`
32004
+ );
32005
+ }
32006
+ }
32007
+ function createCodexMcpSectionPattern(mcpName) {
32008
+ const keyPattern = createCodexMcpKeyPattern(mcpName);
32009
+ return new RegExp(
32010
+ `\\n?\\[mcp_servers\\.${keyPattern}(?:\\.[^\\]]+)?\\][\\s\\S]*?(?=\\n\\[(?!mcp_servers\\.${keyPattern}(?:\\.|\\]))|$)`,
32011
+ "g"
32012
+ );
32013
+ }
32014
+ function createCodexMcpKeyPattern(mcpName) {
32015
+ const quotedKey = `"${escapeRegExp2(mcpName)}"`;
32016
+ if (!isTomlBareKey(mcpName)) {
32017
+ return quotedKey;
32018
+ }
32019
+ return `(?:${quotedKey}|${escapeRegExp2(mcpName)})`;
32020
+ }
32021
+ function findCodexMcpTableDuplicates(text, mcpName) {
32022
+ const seen = /* @__PURE__ */ new Set();
32023
+ const duplicates = /* @__PURE__ */ new Set();
32024
+ const headerPattern = /^\s*\[([^\]]+)\]\s*$/gm;
32025
+ let match;
32026
+ while ((match = headerPattern.exec(text)) !== null) {
32027
+ const normalized = normalizeCodexMcpTablePath(match[1], mcpName);
32028
+ if (!normalized) {
32029
+ continue;
32030
+ }
32031
+ if (seen.has(normalized)) {
32032
+ duplicates.add(normalized);
32033
+ continue;
32034
+ }
32035
+ seen.add(normalized);
32036
+ }
32037
+ return Array.from(duplicates);
32038
+ }
32039
+ function normalizeCodexMcpTablePath(tablePath, mcpName) {
32040
+ const keyPattern = createCodexMcpKeyPattern(mcpName);
32041
+ const match = new RegExp(`^mcp_servers\\.${keyPattern}(\\..+)?$`).exec(tablePath);
32042
+ if (!match) {
32043
+ return void 0;
32044
+ }
32045
+ return `mcp_servers.${mcpName}${match[1] || ""}`;
31999
32046
  }
32000
32047
  function tryClaudeMcpAdd(options) {
32001
32048
  const command = process.platform === "win32" ? "claude.cmd" : "claude";
@@ -32057,10 +32104,19 @@ function asObject(value) {
32057
32104
  }
32058
32105
  function backupIfExists(filePath) {
32059
32106
  if (!fs7.existsSync(filePath)) {
32060
- return;
32107
+ return void 0;
32061
32108
  }
32062
32109
  const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\..+$/, "");
32063
- fs7.copyFileSync(filePath, `${filePath}.bak.${stamp}`);
32110
+ const backupPath = `${filePath}.bak.${stamp}`;
32111
+ fs7.copyFileSync(filePath, backupPath);
32112
+ return backupPath;
32113
+ }
32114
+ function restoreBackup(filePath, backupPath) {
32115
+ if (backupPath) {
32116
+ fs7.copyFileSync(backupPath, filePath);
32117
+ return;
32118
+ }
32119
+ fs7.rmSync(filePath, { force: true });
32064
32120
  }
32065
32121
  function saveInitState(targetDir, state) {
32066
32122
  fs7.mkdirSync(getMakerHome(), { recursive: true });
@@ -32205,6 +32261,9 @@ function escapeRegExp2(value) {
32205
32261
  function escapeToml(value) {
32206
32262
  return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
32207
32263
  }
32264
+ function isTomlBareKey(value) {
32265
+ return /^[A-Za-z0-9_-]+$/.test(value);
32266
+ }
32208
32267
  function indent2(value) {
32209
32268
  return value.split("\n").map((line) => ` ${line}`).join("\n");
32210
32269
  }
package/dist/proxy.js CHANGED
@@ -29137,7 +29137,7 @@ var LogWriter = class {
29137
29137
  };
29138
29138
 
29139
29139
  // src/mcp-proxy/proxy.ts
29140
- var VERSION = true ? "1.23.5" : "dev";
29140
+ var VERSION = true ? "1.23.6" : "dev";
29141
29141
  var TapTapMCPProxy = class {
29142
29142
  constructor(config2) {
29143
29143
  this.connected = false;
package/dist/server.js CHANGED
@@ -6090,7 +6090,7 @@ class MultiplayerManager {
6090
6090
  // 导出
6091
6091
  // export default MultiplayerManager;
6092
6092
  // module.exports = MultiplayerManager;
6093
- // window.MultiplayerManager = MultiplayerManager;`}]}}};var ws;ws="1.23.5";async function FRe(){return Go(Rm,"api_event_relations")}async function BRe(){return Go(Rm,"protocol_template")}async function SD(){return Go(Rm,"complete_example")}async function URe(){return`# TapTap 多人联机集成指南
6093
+ // window.MultiplayerManager = MultiplayerManager;`}]}}};var ws;ws="1.23.6";async function FRe(){return Go(Rm,"api_event_relations")}async function BRe(){return Go(Rm,"protocol_template")}async function SD(){return Go(Rm,"complete_example")}async function URe(){return`# TapTap 多人联机集成指南
6094
6094
 
6095
6095
  ---
6096
6096
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taptap/instant-games-open-mcp",
3
- "version": "1.23.5",
3
+ "version": "1.23.6",
4
4
  "type": "module",
5
5
  "description": "TapTap Open API MCP Server - Documentation and Management APIs for TapTap Minigame and H5 Games (Leaderboard, and more features coming)",
6
6
  "main": "dist/server.js",