gamealia-mcp 0.1.24 → 0.1.26

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.
@@ -39103,7 +39103,7 @@ function staticChecks(a) {
39103
39103
  // ../autotest/src/scan.ts
39104
39104
  init_define_GAMEALIA_DOCS();
39105
39105
  var GAMEPLAY_STOP_RE = /\b(?:sdkG|g)ameplayStop\s*\(|\bGamealiaGameplayStop\b|["']game\.gameplayStop["']/;
39106
- var isScannable = (path) => /\.(html?|m?js)$/i.test(path);
39106
+ var isScannable = (path) => /\.(html?|m?js)(\.(gz|br))?$/i.test(path) || /\.js\.unityweb$/i.test(path);
39107
39107
  var isAnalyzable = (path) => /\.(html?|m?js|css)(\.(gz|br))?$/i.test(path) || /\.js\.unityweb$/i.test(path) || /(^|\/)Build\/[^/]+\.json$/i.test(path);
39108
39108
  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
39109
  var SRC_ASSIGN = /\.src\s*=\s*["'`]([^"'`\s]{4,})["'`]/gi;
@@ -39119,7 +39119,7 @@ function urlTokens(text) {
39119
39119
  return [...out];
39120
39120
  }
39121
39121
  function scanSource(files) {
39122
- const out = { ads: [], trackers: [], miners: [], purchase: [], login: [], gameplayStop: false, scanned: files.length };
39122
+ const out = { ads: [], trackers: [], miners: [], purchase: [], login: [], gameplayStop: false, engineBuild: false, scanned: files.length };
39123
39123
  const bucket = { ads: out.ads, tracker: out.trackers, miner: out.miners };
39124
39124
  for (const f of files) {
39125
39125
  for (const u of urlTokens(f.text)) {
@@ -39127,6 +39127,7 @@ function scanSource(files) {
39127
39127
  if (c) bucket[c].push({ path: f.path, pattern: u });
39128
39128
  }
39129
39129
  if (!out.gameplayStop && GAMEPLAY_STOP_RE.test(f.text)) out.gameplayStop = true;
39130
+ if (!out.engineBuild && /\bcreateUnityInstance\b|\bGODOT_CONFIG\b|\bnew Engine\(/.test(f.text)) out.engineBuild = true;
39130
39131
  const lower = f.text.toLowerCase();
39131
39132
  for (const [cat, pats] of Object.entries(STATIC_PATTERNS))
39132
39133
  for (const p of pats) if (lower.includes(p)) out[cat].push({ path: f.path, pattern: p });
@@ -39155,14 +39156,48 @@ var MAX_SCAN_BYTES = 5 * 1024 * 1024;
39155
39156
  var SOURCE_READ_MS = 1e4;
39156
39157
  var isCompressed = (p) => /\.(gz|br|unityweb)$/i.test(p);
39157
39158
  var READ_CONCURRENCY = 4;
39159
+ async function gunzipWeb(b, cap2 = MAX_SCAN_BYTES) {
39160
+ if (typeof DecompressionStream === "undefined") return null;
39161
+ const reader = new Blob([b]).stream().pipeThrough(new DecompressionStream("gzip")).getReader();
39162
+ const chunks = [];
39163
+ let total = 0;
39164
+ let truncated = false;
39165
+ try {
39166
+ for (; ; ) {
39167
+ const { done, value } = await reader.read();
39168
+ if (done) break;
39169
+ chunks.push(value);
39170
+ total += value.length;
39171
+ if (total >= cap2) {
39172
+ truncated = total > cap2 || !(await reader.read()).done;
39173
+ break;
39174
+ }
39175
+ }
39176
+ } catch {
39177
+ if (!total) return null;
39178
+ truncated = true;
39179
+ } finally {
39180
+ reader.cancel().catch(() => {
39181
+ });
39182
+ }
39183
+ const out = new Uint8Array(Math.min(total, cap2));
39184
+ let off = 0;
39185
+ for (const c of chunks) {
39186
+ const n = Math.min(c.length, out.length - off);
39187
+ out.set(c.subarray(0, n), off);
39188
+ off += n;
39189
+ }
39190
+ return { data: out, truncated };
39191
+ }
39158
39192
  async function decompress(b, cap2 = MAX_SCAN_BYTES) {
39193
+ const gzip = b[0] === 31 && b[1] === 139;
39159
39194
  let z2;
39160
39195
  try {
39161
39196
  z2 = await import("node:zlib");
39197
+ if (typeof z2.createBrotliDecompress !== "function") throw new Error("no zlib");
39162
39198
  } catch {
39163
- return null;
39199
+ return gzip ? gunzipWeb(b, cap2) : null;
39164
39200
  }
39165
- const gzip = b[0] === 31 && b[1] === 139;
39166
39201
  const stream = gzip ? z2.createGunzip() : z2.createBrotliDecompress();
39167
39202
  return new Promise((resolve12) => {
39168
39203
  const chunks = [];
@@ -43326,7 +43361,9 @@ function checkInputResponse(before, after, target) {
43326
43361
  // ../autotest/src/checks/sdk.ts
43327
43362
  init_define_GAMEALIA_DOCS();
43328
43363
  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");
43364
+ if (f.gameplayStop || o.trace.some((t) => t.type === "gameplayStop")) return result("gameplay_stop", "pass", "gameplayStop() is called");
43365
+ 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)");
43366
+ 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
43367
  }
43331
43368
  var SDK_URL_RE = /\/sdk\/(v1|crazygames|poki)\.js([?#]|$)/;
43332
43369
  function checkSdk(o, sdkScript = null, unreachable = []) {
@@ -43495,6 +43532,8 @@ var SHOT_AT_MS = 5e3;
43495
43532
  var INPUT_SETTLE_MS = 1e3;
43496
43533
  var AD_WATCH_MS = 2e3;
43497
43534
  var AD_FINISH_MS = 4e3;
43535
+ var LATE_LOAD_MS = 15e3;
43536
+ var lateLoadWaitMs = (graceMs) => Math.min(LATE_LOAD_MS, Math.floor(graceMs / 2));
43498
43537
  var POLL_MS = 200;
43499
43538
  var OP_MS = 1e4;
43500
43539
  var CLOSE_MS = 1e4;
@@ -43504,7 +43543,7 @@ var msg = (e) => e instanceof Error ? e.message : String(e);
43504
43543
  var EMPTY_STATE = { trace: [], adRequests: 0, adsShown: 0, error: null };
43505
43544
  var Unresponsive = class extends Error {
43506
43545
  };
43507
- async function drive(o, p, timeoutMs, c) {
43546
+ async function drive(o, p, timeoutMs, graceMs, c) {
43508
43547
  const { obs } = c;
43509
43548
  const op = (what, fn) => c.aborted ? Promise.reject(new Error("aborted")) : withTimeout(fn(), OP_MS, what);
43510
43549
  const origin = gameOrigin(o.harnessUrl);
@@ -43566,9 +43605,13 @@ async function drive(o, p, timeoutMs, c) {
43566
43605
  obs.shotError = msg(e);
43567
43606
  throw e;
43568
43607
  }
43569
- while (!c.aborted && Date.now() - t0 < timeoutMs) {
43608
+ const has = (type) => c.state.trace.some((t) => t.type === type);
43609
+ const lateMs = lateLoadWaitMs(graceMs);
43610
+ while (!c.aborted) {
43570
43611
  await read();
43571
- if (c.state.trace.some((t) => t.type === "loadingStop")) break;
43612
+ if (has("loadingStop")) break;
43613
+ const waited = Date.now() - t0;
43614
+ if (waited >= timeoutMs && (!has("loadingStart") || waited >= timeoutMs + lateMs)) break;
43572
43615
  await sleep(POLL_MS);
43573
43616
  }
43574
43617
  obs.before = decode3(await png()).img;
@@ -43636,7 +43679,7 @@ async function runProfile(o, p, timeoutMs, graceMs) {
43636
43679
  let timer;
43637
43680
  const deadline = new Promise((r) => timer = setTimeout(() => r("deadline"), timeoutMs + graceMs));
43638
43681
  const outcome = await Promise.race([
43639
- drive(o, p, timeoutMs, c).then(
43682
+ drive(o, p, timeoutMs, graceMs, c).then(
43640
43683
  () => "done",
43641
43684
  (e) => {
43642
43685
  obs.console.push({ level: "error", text: `autotest: ${e instanceof Unresponsive ? e.message : `error: ${msg(e)}`}` });
@@ -56887,7 +56930,7 @@ ${frameText(r, m31)}`,
56887
56930
  }
56888
56931
 
56889
56932
  // src/server.ts
56890
- var VERSION2 = true ? "0.1.24" : "0.0.0-dev";
56933
+ var VERSION2 = true ? "0.1.26" : "0.0.0-dev";
56891
56934
  var INSTRUCTIONS = `Gamealia is a web games portal. These tools publish a game end to end:
56892
56935
  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
56936
  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.26",
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",