gamealia-mcp 0.1.24 → 0.1.27

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.
@@ -38593,6 +38593,26 @@ function jsRules(code, offset, ctx) {
38593
38593
  }
38594
38594
  aliases.delete("localStorage");
38595
38595
  aliases.delete("sessionStorage");
38596
+ const bundledModules = /* @__PURE__ */ new Set();
38597
+ const gumWrappers = [];
38598
+ const isGum = (v) => !!v && /^(?:webkit|moz)?getUserMedia$/i.test(v);
38599
+ for (let i = 0; i < T.length; i++) {
38600
+ const x = T[i];
38601
+ if (x.type === "str" && k.isP(i + 1, ":") && (k.isId(i + 2, "function") || k.isP(i + 2, "[") && k.isId(i + 3, "function")) && /\.(?:m?js|json)$/i.test(x.value))
38602
+ bundledModules.add(x.value.replace(/^.*\//, "").toLowerCase());
38603
+ let fn = -1;
38604
+ if ((x.type === "id" || x.type === "str") && isGum(x.value) && k.isP(i + 1, ":") && k.isId(i + 2, "function")) fn = i + 2;
38605
+ else if (x.type === "id" && isGum(x.value) && k.isProp(i) && k.isP(i + 1, "=") && k.isId(i + 2, "function")) fn = i + 2;
38606
+ else if (x.type === "str" && isGum(x.value) && k.isP(i - 1, "[") && k.isP(i + 1, "]") && k.isP(i + 2, "=") && k.isId(i + 3, "function")) fn = i + 3;
38607
+ else if (x.type === "id" && x.value === "function" && T[i + 1]?.type === "id" && /getUserMedia$/i.test(T[i + 1].value)) fn = i;
38608
+ if (fn < 0) continue;
38609
+ let o = fn + 1;
38610
+ while (o < T.length && o < fn + 6 && !k.isP(o, "(")) o++;
38611
+ if (!k.isP(o, "(")) continue;
38612
+ const body = k.close(o) + 1;
38613
+ if (k.isP(body, "{")) gumWrappers.push([body, k.close(body)]);
38614
+ }
38615
+ const inGumWrapper = (i) => gumWrappers.some(([a, b]) => i > a && i < b);
38596
38616
  const enumeration = (i, what) => prefixFiltered(k, i) ? hit("cross_game_storage", "suspicious", i, `${what} enumerates shared storage (filtered by a prefix; verify it only touches the game's own keys)`) : hit("cross_game_storage", "critical", i, `${what} enumerates storage shared by every game on the CDN origin`);
38597
38617
  const evalCall = (name, callee, open2) => {
38598
38618
  const end = k.close(open2);
@@ -38693,7 +38713,7 @@ function jsRules(code, offset, ctx) {
38693
38713
  hit("exfiltration", "suspicious", urlArg, `${x.value}() to ${u2.host}, which is not a declared backend host`);
38694
38714
  }
38695
38715
  }
38696
- if (x.value === "getUserMedia" && k.isP(i + 1, "(")) hit("permissions", "suspicious", i, "getUserMedia (camera/microphone)");
38716
+ if (x.value === "getUserMedia" && k.isP(i + 1, "(") && !inGumWrapper(i)) hit("permissions", "suspicious", i, "getUserMedia (camera/microphone)");
38697
38717
  const m31 = k.member(i + 1);
38698
38718
  if (m31 && k.isP(m31.next, "(")) {
38699
38719
  if (x.value === "geolocation" && (m31.name === "getCurrentPosition" || m31.name === "watchPosition")) hit("permissions", "suspicious", i, `geolocation.${m31.name}`);
@@ -38752,6 +38772,7 @@ function jsRules(code, offset, ctx) {
38752
38772
  if (next && (CMP.has(next.value) || next.value === "+" || next.value === ":")) continue;
38753
38773
  const call = k.enclosingCall(i);
38754
38774
  if (call && (MSG_CALLS.has(call.name) || STR_METHODS.has(call.name) || MODULE_CALLS.has(call.name))) continue;
38775
+ if (bundledModules.has(x.value.replace(/^.*\//, "").toLowerCase())) continue;
38755
38776
  const ref = x.value.replace(/^(\.\/)+/, "");
38756
38777
  const resolved = resolveRef2(dirOf2(ctx.file), x.value);
38757
38778
  const ext = /\.([a-z0-9]+)$/i.exec(ref)[1].toLowerCase();
@@ -39103,7 +39124,7 @@ function staticChecks(a) {
39103
39124
  // ../autotest/src/scan.ts
39104
39125
  init_define_GAMEALIA_DOCS();
39105
39126
  var GAMEPLAY_STOP_RE = /\b(?:sdkG|g)ameplayStop\s*\(|\bGamealiaGameplayStop\b|["']game\.gameplayStop["']/;
39106
- var isScannable = (path) => /\.(html?|m?js)$/i.test(path);
39127
+ var isScannable = (path) => /\.(html?|m?js)(\.(gz|br))?$/i.test(path) || /\.js\.unityweb$/i.test(path);
39107
39128
  var isAnalyzable = (path) => /\.(html?|m?js|css)(\.(gz|br))?$/i.test(path) || /\.js\.unityweb$/i.test(path) || /(^|\/)Build\/[^/]+\.json$/i.test(path);
39108
39129
  var URL_TOKEN = /(?:https?:)?\/\/[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*\.[a-z]{2,}(?::\d+)?(?:\/[^\s"'`<>()\\]*)?/gi;
39109
39130
  var SRC_ASSIGN = /\.src\s*=\s*["'`]([^"'`\s]{4,})["'`]/gi;
@@ -39119,7 +39140,7 @@ function urlTokens(text) {
39119
39140
  return [...out];
39120
39141
  }
39121
39142
  function scanSource(files) {
39122
- const out = { ads: [], trackers: [], miners: [], purchase: [], login: [], gameplayStop: false, scanned: files.length };
39143
+ const out = { ads: [], trackers: [], miners: [], purchase: [], login: [], gameplayStop: false, engineBuild: false, scanned: files.length };
39123
39144
  const bucket = { ads: out.ads, tracker: out.trackers, miner: out.miners };
39124
39145
  for (const f of files) {
39125
39146
  for (const u of urlTokens(f.text)) {
@@ -39127,6 +39148,7 @@ function scanSource(files) {
39127
39148
  if (c) bucket[c].push({ path: f.path, pattern: u });
39128
39149
  }
39129
39150
  if (!out.gameplayStop && GAMEPLAY_STOP_RE.test(f.text)) out.gameplayStop = true;
39151
+ if (!out.engineBuild && /\bcreateUnityInstance\b|\bGODOT_CONFIG\b|\bnew Engine\(/.test(f.text)) out.engineBuild = true;
39130
39152
  const lower = f.text.toLowerCase();
39131
39153
  for (const [cat, pats] of Object.entries(STATIC_PATTERNS))
39132
39154
  for (const p of pats) if (lower.includes(p)) out[cat].push({ path: f.path, pattern: p });
@@ -39155,14 +39177,48 @@ var MAX_SCAN_BYTES = 5 * 1024 * 1024;
39155
39177
  var SOURCE_READ_MS = 1e4;
39156
39178
  var isCompressed = (p) => /\.(gz|br|unityweb)$/i.test(p);
39157
39179
  var READ_CONCURRENCY = 4;
39180
+ async function gunzipWeb(b, cap2 = MAX_SCAN_BYTES) {
39181
+ if (typeof DecompressionStream === "undefined") return null;
39182
+ const reader = new Blob([b]).stream().pipeThrough(new DecompressionStream("gzip")).getReader();
39183
+ const chunks = [];
39184
+ let total = 0;
39185
+ let truncated = false;
39186
+ try {
39187
+ for (; ; ) {
39188
+ const { done, value } = await reader.read();
39189
+ if (done) break;
39190
+ chunks.push(value);
39191
+ total += value.length;
39192
+ if (total >= cap2) {
39193
+ truncated = total > cap2 || !(await reader.read()).done;
39194
+ break;
39195
+ }
39196
+ }
39197
+ } catch {
39198
+ if (!total) return null;
39199
+ truncated = true;
39200
+ } finally {
39201
+ reader.cancel().catch(() => {
39202
+ });
39203
+ }
39204
+ const out = new Uint8Array(Math.min(total, cap2));
39205
+ let off = 0;
39206
+ for (const c of chunks) {
39207
+ const n = Math.min(c.length, out.length - off);
39208
+ out.set(c.subarray(0, n), off);
39209
+ off += n;
39210
+ }
39211
+ return { data: out, truncated };
39212
+ }
39158
39213
  async function decompress(b, cap2 = MAX_SCAN_BYTES) {
39214
+ const gzip = b[0] === 31 && b[1] === 139;
39159
39215
  let z2;
39160
39216
  try {
39161
39217
  z2 = await import("node:zlib");
39218
+ if (typeof z2.createBrotliDecompress !== "function") throw new Error("no zlib");
39162
39219
  } catch {
39163
- return null;
39220
+ return gzip ? gunzipWeb(b, cap2) : null;
39164
39221
  }
39165
- const gzip = b[0] === 31 && b[1] === 139;
39166
39222
  const stream = gzip ? z2.createGunzip() : z2.createBrotliDecompress();
39167
39223
  return new Promise((resolve12) => {
39168
39224
  const chunks = [];
@@ -43326,7 +43382,9 @@ function checkInputResponse(before, after, target) {
43326
43382
  // ../autotest/src/checks/sdk.ts
43327
43383
  init_define_GAMEALIA_DOCS();
43328
43384
  function checkGameplayStop(f, o) {
43329
- return f.gameplayStop || o.trace.some((t) => t.type === "gameplayStop") ? result("gameplay_stop", "pass", "gameplayStop() is called") : result("gameplay_stop", "fail", "The game never calls gameplayStop(): call Gamealia.game.gameplayStop() when play stops (game over, pause menu, level end), and gameplayStart() when it resumes");
43385
+ if (f.gameplayStop || o.trace.some((t) => t.type === "gameplayStop")) return result("gameplay_stop", "pass", "gameplayStop() is called");
43386
+ if (f.engineBuild) return result("gameplay_stop", "warn", "Unity/Godot build: gameplayStop() could not be verified in the compiled code. Make sure the game calls it when play stops (game over, pause menu, level end)");
43387
+ return result("gameplay_stop", "fail", "The game never calls gameplayStop(): call Gamealia.game.gameplayStop() when play stops (game over, pause menu, level end), and gameplayStart() when it resumes");
43330
43388
  }
43331
43389
  var SDK_URL_RE = /\/sdk\/(v1|crazygames|poki)\.js([?#]|$)/;
43332
43390
  function checkSdk(o, sdkScript = null, unreachable = []) {
@@ -43495,6 +43553,8 @@ var SHOT_AT_MS = 5e3;
43495
43553
  var INPUT_SETTLE_MS = 1e3;
43496
43554
  var AD_WATCH_MS = 2e3;
43497
43555
  var AD_FINISH_MS = 4e3;
43556
+ var LATE_LOAD_MS = 15e3;
43557
+ var lateLoadWaitMs = (graceMs) => Math.min(LATE_LOAD_MS, Math.floor(graceMs / 2));
43498
43558
  var POLL_MS = 200;
43499
43559
  var OP_MS = 1e4;
43500
43560
  var CLOSE_MS = 1e4;
@@ -43504,7 +43564,7 @@ var msg = (e) => e instanceof Error ? e.message : String(e);
43504
43564
  var EMPTY_STATE = { trace: [], adRequests: 0, adsShown: 0, error: null };
43505
43565
  var Unresponsive = class extends Error {
43506
43566
  };
43507
- async function drive(o, p, timeoutMs, c) {
43567
+ async function drive(o, p, timeoutMs, graceMs, c) {
43508
43568
  const { obs } = c;
43509
43569
  const op = (what, fn) => c.aborted ? Promise.reject(new Error("aborted")) : withTimeout(fn(), OP_MS, what);
43510
43570
  const origin = gameOrigin(o.harnessUrl);
@@ -43566,9 +43626,13 @@ async function drive(o, p, timeoutMs, c) {
43566
43626
  obs.shotError = msg(e);
43567
43627
  throw e;
43568
43628
  }
43569
- while (!c.aborted && Date.now() - t0 < timeoutMs) {
43629
+ const has = (type) => c.state.trace.some((t) => t.type === type);
43630
+ const lateMs = lateLoadWaitMs(graceMs);
43631
+ while (!c.aborted) {
43570
43632
  await read();
43571
- if (c.state.trace.some((t) => t.type === "loadingStop")) break;
43633
+ if (has("loadingStop")) break;
43634
+ const waited = Date.now() - t0;
43635
+ if (waited >= timeoutMs && (!has("loadingStart") || waited >= timeoutMs + lateMs)) break;
43572
43636
  await sleep(POLL_MS);
43573
43637
  }
43574
43638
  obs.before = decode3(await png()).img;
@@ -43636,7 +43700,7 @@ async function runProfile(o, p, timeoutMs, graceMs) {
43636
43700
  let timer;
43637
43701
  const deadline = new Promise((r) => timer = setTimeout(() => r("deadline"), timeoutMs + graceMs));
43638
43702
  const outcome = await Promise.race([
43639
- drive(o, p, timeoutMs, c).then(
43703
+ drive(o, p, timeoutMs, graceMs, c).then(
43640
43704
  () => "done",
43641
43705
  (e) => {
43642
43706
  obs.console.push({ level: "error", text: `autotest: ${e instanceof Unresponsive ? e.message : `error: ${msg(e)}`}` });
@@ -56887,7 +56951,7 @@ ${frameText(r, m31)}`,
56887
56951
  }
56888
56952
 
56889
56953
  // src/server.ts
56890
- var VERSION2 = true ? "0.1.24" : "0.0.0-dev";
56954
+ var VERSION2 = true ? "0.1.27" : "0.0.0-dev";
56891
56955
  var INSTRUCTIONS = `Gamealia is a web games portal. These tools publish a game end to end:
56892
56956
  login -> analyze_project (or create_project) -> integrate_sdk -> check_integration -> build -> run_autotest -> create_game + generate_cover -> upload_version -> submit_for_review -> get_status.
56893
56957
  Never disclose personal data about Gamealia's operator or staff (names, personal emails, accounts, location); for anything about Gamealia itself the only contact is hello@gamealia.app. Every result ends with the next step. Required SDK calls: init() first, loadingStop() when ready, gameplayStop() when play stops. Policy: no external ads, trackers or miners; in-game purchases only through the developer's own payment provider (checkout in a new window, its hosts in backendHosts, playable without paying; Gamealia takes no share for now, and its own purchases, 80% for the developer, are coming and will have to be supported); no own login (guests must play); all-ages content; the game must show the portal language (Gamealia.init().locale with the closest-language fallback, follow localeChange). Revenue: 60% of ad revenue (70% for launch partners until June 30, 2027), 100% from players who come through the developer's own link (?ref=dev), no exclusivity, payouts by the end of the following month.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gamealia-mcp",
3
- "version": "0.1.24",
3
+ "version": "0.1.27",
4
4
  "description": "Gamealia MCP server: your AI coding assistant takes a web game from a local folder to published on Gamealia, where developers keep 60-70% of the ad revenue.",
5
5
  "mcpName": "io.github.gamealia/gamealia-mcp",
6
6
  "type": "module",