paralith-mcp 0.3.1 → 0.3.2

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/http.mjs CHANGED
@@ -304,6 +304,34 @@ import { z as z9 } from "zod";
304
304
 
305
305
  // src/tool.mjs
306
306
  import { z } from "zod";
307
+
308
+ // src/update.mjs
309
+ var VERSION = "0.3.2";
310
+ var CHECK_MS = 6 * 36e5;
311
+ var NOTE_MS = 36e5;
312
+ var latest = null;
313
+ var checkedAt = 0;
314
+ var notedAt = 0;
315
+ var newer = (a, b) => {
316
+ const [x, y] = [a, b].map((v) => v.split(".").map(Number));
317
+ for (let i = 0; i < 3; i++) if (x[i] !== y[i]) return x[i] > y[i];
318
+ return false;
319
+ };
320
+ function check(now) {
321
+ checkedAt = now;
322
+ fetch("https://registry.npmjs.org/paralith-mcp/latest", { signal: AbortSignal.timeout(1e4) }).then((r) => r.ok ? r.json() : null).then((j) => {
323
+ if (j?.version) latest = j.version;
324
+ }, () => {
325
+ });
326
+ }
327
+ function updateNote(now = Date.now()) {
328
+ if (now - checkedAt > CHECK_MS) check(now);
329
+ if (!latest || !newer(latest, VERSION) || now - notedAt < NOTE_MS) return null;
330
+ notedAt = now;
331
+ return `paralith-mcp ${latest} is out (this is ${VERSION}). Tell the user to restart this app to get it.`;
332
+ }
333
+
334
+ // src/tool.mjs
307
335
  var migrationSeen = null;
308
336
  async function migrationRefusal(read = readKey, now = Date.now()) {
309
337
  if (!migrationSeen || now - migrationSeen.at > 15e3) {
@@ -328,7 +356,8 @@ function tool(server, name, description, inputSchema, run, annotations = {}, vie
328
356
  const raw = await run(args ?? {});
329
357
  const value = view && !args?.full ? await view(raw) : raw;
330
358
  const text = typeof value === "string" ? value : JSON.stringify(value, bigints, 2);
331
- return { content: [{ type: "text", text: text ?? "null" }] };
359
+ const note = READ_ONLY ? null : updateNote();
360
+ return { content: [{ type: "text", text: text ?? "null" }, ...note ? [{ type: "text", text: note }] : []] };
332
361
  } catch (error) {
333
362
  return { isError: true, content: [{ type: "text", text: explain(error) }] };
334
363
  }
@@ -1906,7 +1935,7 @@ var READ_ONLY_NOTE = `This endpoint is READ-ONLY: it explains the protocol and r
1906
1935
  To play, trade or bridge, run the local server with a wallet phrase: ${DOCS}/ai/mcp`;
1907
1936
  function buildServer() {
1908
1937
  const server = new McpServer(
1909
- { name: "paralith", version: "0.3.1" },
1938
+ { name: "paralith", version: VERSION },
1910
1939
  { instructions: READ_ONLY ? `${READ_ONLY_NOTE}
1911
1940
 
1912
1941
  ${INSTRUCTIONS}` : INSTRUCTIONS }
package/dist/server.mjs CHANGED
@@ -511,6 +511,38 @@ var init_runtime = __esm({
511
511
  }
512
512
  });
513
513
 
514
+ // src/update.mjs
515
+ function check(now) {
516
+ checkedAt = now;
517
+ fetch("https://registry.npmjs.org/paralith-mcp/latest", { signal: AbortSignal.timeout(1e4) }).then((r) => r.ok ? r.json() : null).then((j) => {
518
+ if (j?.version) latest = j.version;
519
+ }, () => {
520
+ });
521
+ }
522
+ function updateNote(now = Date.now()) {
523
+ if (now - checkedAt > CHECK_MS) check(now);
524
+ if (!latest || !newer(latest, VERSION) || now - notedAt < NOTE_MS) return null;
525
+ notedAt = now;
526
+ return `paralith-mcp ${latest} is out (this is ${VERSION}). Tell the user to restart this app to get it.`;
527
+ }
528
+ var VERSION, CHECK_MS, NOTE_MS, latest, checkedAt, notedAt, newer;
529
+ var init_update = __esm({
530
+ "src/update.mjs"() {
531
+ "use strict";
532
+ VERSION = "0.3.2";
533
+ CHECK_MS = 6 * 36e5;
534
+ NOTE_MS = 36e5;
535
+ latest = null;
536
+ checkedAt = 0;
537
+ notedAt = 0;
538
+ newer = (a, b) => {
539
+ const [x, y] = [a, b].map((v) => v.split(".").map(Number));
540
+ for (let i = 0; i < 3; i++) if (x[i] !== y[i]) return x[i] > y[i];
541
+ return false;
542
+ };
543
+ }
544
+ });
545
+
514
546
  // src/tool.mjs
515
547
  import { z } from "zod";
516
548
  async function migrationRefusal(read = readKey, now = Date.now()) {
@@ -536,7 +568,8 @@ function tool(server, name, description, inputSchema, run2, annotations = {}, vi
536
568
  const raw = await run2(args ?? {});
537
569
  const value = view && !args?.full ? await view(raw) : raw;
538
570
  const text = typeof value === "string" ? value : JSON.stringify(value, bigints, 2);
539
- return { content: [{ type: "text", text: text ?? "null" }] };
571
+ const note = READ_ONLY ? null : updateNote();
572
+ return { content: [{ type: "text", text: text ?? "null" }, ...note ? [{ type: "text", text: note }] : []] };
540
573
  } catch (error) {
541
574
  return { isError: true, content: [{ type: "text", text: explain(error) }] };
542
575
  }
@@ -557,6 +590,7 @@ var init_tool = __esm({
557
590
  "src/tool.mjs"() {
558
591
  "use strict";
559
592
  init_runtime();
593
+ init_update();
560
594
  migrationSeen = null;
561
595
  bigints = (_k, v) => typeof v === "bigint" ? v.toString() : v;
562
596
  READ = { readOnlyHint: true, openWorldHint: true };
@@ -2152,7 +2186,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2152
2186
  import { z as z9 } from "zod";
2153
2187
  function buildServer() {
2154
2188
  const server = new McpServer(
2155
- { name: "paralith", version: "0.3.1" },
2189
+ { name: "paralith", version: VERSION },
2156
2190
  { instructions: READ_ONLY ? `${READ_ONLY_NOTE}
2157
2191
 
2158
2192
  ${INSTRUCTIONS}` : INSTRUCTIONS }
@@ -2242,6 +2276,7 @@ var init_build = __esm({
2242
2276
  init_vaults();
2243
2277
  init_show();
2244
2278
  init_progress();
2279
+ init_update();
2245
2280
  DOCS = process.env.PARALITH_DOCS_URL || "https://docs.paralithmarkets.com";
2246
2281
  INSTRUCTIONS = `Paralith on AO (HyperBEAM): Rune Realm (a companion game), two order books, and the PUSD bridge.
2247
2282
  Everything is TEST-prefixed while unreleased. Reads are free; every write is a signed message (a few seconds round trip, longer under load).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paralith-mcp",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "MCP server for Paralith on AO: an AI with one 24-word phrase plays Rune Realm, trades and bridges PUSD (TEST deployment).",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://docs.paralithmarkets.com/ai/mcp",