@mavonengine/cli 0.0.7 → 0.0.9

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
@@ -380,7 +380,7 @@ Client tools, for the game tabs open while Vite serves the client in dev:
380
380
  | `network_timeline` | The server's records for one tab and the tab's own, merged by time |
381
381
  | `client_logs` | Console output, uncaught errors and unhandled rejections, filtered by level and text |
382
382
  | `client_screenshot` | What the tab renders, as an image (the WebGL canvas, without HTML UI) |
383
- | `client_trace` | Records a few seconds of the tab and analyses it: frame times, render CPU vs GPU, composer passes, ticks, WebGL work per frame, the bottleneck, and the worst hitches with their causes. Saves a flame chart trace file |
383
+ | `client_trace` | Records a few seconds of the tab and analyses it: frame times, render CPU vs GPU, the render pipeline and its effects, ticks, WebGL work per frame, the bottleneck, and the worst hitches with their causes. Saves a flame chart trace file |
384
384
  | `compare_entity` | One entity on the server next to a tab's copy: position / rotation / scale deltas and differing fields |
385
385
 
386
386
  Plugin tools:
@@ -391,7 +391,7 @@ Plugin tools:
391
391
  | `available_plugins` | The official plugins from [`mavonengine plugins`](#mavonengine-plugins): what each does, where it runs, the command that installs it, and whether the project already has it |
392
392
  | `plugin_readme` | The README of one of them as Markdown: its options, how a game hooks into it and its limits |
393
393
 
394
- With these an assistant can suggest a plugin instead of building what one already does, and set it up from its readme. It can't install one: every tool is read-only, so it hands you the command. `available_plugins` and `plugin_readme` read the list and the readmes from GitHub when they are used; `--plugins-url` or `MAVONENGINE_PLUGINS_URL` points them at another list and `--no-plugin-list` leaves them out.
394
+ With these an assistant can suggest a plugin instead of building what one already does, and set it up from its readme. It can't install one: these tools are read-only, so it hands you the command. `available_plugins` and `plugin_readme` read the list and the readmes from GitHub when they are used; `--plugins-url` or `MAVONENGINE_PLUGINS_URL` points them at another list and `--no-plugin-list` leaves them out.
395
395
 
396
396
  Database tools, for the project's database plugin such as [`@mavonengine/sqlite`](https://github.com/MavonEngine/Core/tree/main/packages/plugins/sqlite):
397
397
 
@@ -413,13 +413,21 @@ They connect to the site the first time one is used, so the other tools also wor
413
413
 
414
414
  Client tools take a `clientId` from `list_clients`. Without one they ask the only open tab, or the only one not running the editor.
415
415
 
416
- Every tool is read-only. It takes `--host`, `--port`, `--url` and `--token` like the dashboard, where `--url` is the server's base URL (`http://localhost:8050`). When Vite serves the client on its own port instead of through the game server, pass `--client-url`, e.g. `http://localhost:5173`.
416
+ Tools from your project's plugins, while the client's dev server runs:
417
+
418
+ | Tool | |
419
+ | --- | --- |
420
+ | `<plugin>_<tool>` | Whatever the project's plugins offer through their [dev entries](#dev-entries), e.g. `kenney_search_packs` and `kenney_import` from `@mavonengine/kenney`, or `mail_inbox` and `mail_read` from `@mavonengine/mail`. Each says in its description what it does |
421
+
422
+ They appear when the dev server starts and go when plugins are removed: `mavonengine mcp` asks the dev server every few seconds and tells your assistant when the list changes. Unlike the tools above, a plugin's tool may change your project, e.g. copy files into it or edit `mavonengine.json`. Each says whether it does, and your MCP client asks you before running one that changes something. `--read-only` leaves those out.
423
+
424
+ The engine's own tools are read-only. It takes `--host`, `--port`, `--url` and `--token` like the dashboard, where `--url` is the server's base URL (`http://localhost:8050`). When Vite serves the client on its own port instead of through the game server, pass `--client-url`, e.g. `http://localhost:5173`.
417
425
 
418
426
  The server scene and entity tools read `GET /api/game/dev/*` on the game server. Those routes are only registered when `NODE_ENV` is not `production`: a metrics token does not turn them on there. Otherwise they follow the [server access](#server-access) rules of the metrics endpoint.
419
427
 
420
428
  The client tools go through the dev bridge of the Vite plugin in `@mavonengine/core/vite.config` (Vite 8). In dev it adds a small module to the page that answers over Vite's hot-reload WebSocket, and serves `GET /__mavonengine/clients` to localhost, or with `MAVONENGINE_METRICS_TOKEN` as bearer token when that is set for the dev server. Builds never include it. Turn it off with `mavonEnginePlugins({ devBridge: false })`.
421
429
 
422
- `client_trace` patches the tab only while it records and puts everything back afterwards. It times every frame and composer pass, counts the WebGL calls on the context, keeps slow single calls (shader compiles, texture uploads, `readPixels` / `getError` stalls), long animation frames with the scripts that ran, and your own `performance.measure()` spans. GPU time per frame needs `EXT_disjoint_timer_query_webgl2` (Chrome and Edge on most GPUs; the three-perf panel pauses while tracing since it uses the same queries). JS call stacks come from the [JS Self-Profiling API](https://wicg.github.io/js-self-profiling/) in Chromium browsers: the Vite plugin serves dev pages with `Document-Policy: js-profiling` for it, so reload tabs opened before you updated. The trace file is [Chrome Trace Event](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU) JSON with tracks for frames, passes, GPU time, ticks, JS samples and slow WebGL calls: open it in [Perfetto](https://ui.perfetto.dev), `chrome://tracing` or [speedscope](https://www.speedscope.app). Keep the tab in the foreground while it records, browsers throttle hidden tabs.
430
+ `client_trace` patches the tab only while it records and puts everything back afterwards. It times every frame and the render pipeline, counts the WebGL calls on the context (so it needs the WebGL 2 backend, the default), keeps slow single calls (shader compiles, texture uploads, `readPixels` / `getError` stalls), long animation frames with the scripts that ran, and your own `performance.measure()` spans. GPU time per frame needs `EXT_disjoint_timer_query_webgl2` (Chrome and Edge on most GPUs; the inspector's GPU timing pauses while tracing since it uses the same queries). JS call stacks come from the [JS Self-Profiling API](https://wicg.github.io/js-self-profiling/) in Chromium browsers: the Vite plugin serves dev pages with `Document-Policy: js-profiling` for it, so reload tabs opened before you updated. The trace file is [Chrome Trace Event](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU) JSON with tracks for frames, passes, GPU time, ticks, JS samples and slow WebGL calls: open it in [Perfetto](https://ui.perfetto.dev), `chrome://tracing` or [speedscope](https://www.speedscope.app). Keep the tab in the foreground while it records, browsers throttle hidden tabs.
423
431
 
424
432
  The network tools read what both sides record while developing: every message through the game socket, the engine's and your own, with its size, and events such as `connect`, `disconnect`, `dropped` (the transport dropped a message), `sync_enter` / `sync_leave` (entities coming into or leaving a player's sync distance) and, on a client, `state_gap` (state updates that never arrived) and `state_out_of_order`. Each side keeps its last 2000 records, and 8 MB of their payloads. The server records when `NODE_ENV` is not `production` and serves them on `GET /api/game/dev/net/packets`, `/packets/:id` and `/sync`; a tab records while the dev bridge or the editor runs. Nothing is recorded, and the socket is left untouched, in a production build. `network_timeline` orders the two sides by their own clocks, which line up on one machine.
425
433
 
@@ -452,6 +460,8 @@ To let `compare_entity` match your own player with the server's, set `game.local
452
460
 
453
461
  - `target`: `client`, `server` or `both`. The matching entries are required.
454
462
  - `assets`: paths relative to `dir` (default `assets`). They are served at `/plugins/<package>/<path>`: all of them in dev, and only the shared ones and those of used prefabs in a release.
463
+ - `dev`: optional, for any target. An entry that runs in the client's Vite dev server, see [Dev entries](#dev-entries).
464
+ - `reloadOnOptions`: default `true`. Set it to `false` when the plugin changes its own `options` while the editor is open and its client picks up the change without a reload.
455
465
 
456
466
  Each entry default-exports the plugin. Every hook gets the plugin's context last, which carries `package`, `options`, `game` and `logger`.
457
467
 
@@ -460,11 +470,19 @@ Each entry default-exports the plugin. Every hook gets the plugin's context last
460
470
  import { defineClientPlugin } from '@mavonengine/core/Plugins/types'
461
471
 
462
472
  export default defineClientPlugin({
463
- assets: ctx => [{ name: 'tree', type: 'gltfModel', path: ctx.assetUrl('models/tree.glb') }],
473
+ assets: ctx => [
474
+ {
475
+ name: 'tree',
476
+ type: 'gltfModel',
477
+ path: ctx.assetUrl('models/tree.glb')
478
+ }
479
+ ],
464
480
  setup(ctx) {
465
481
  ctx.registerPrefab({
466
482
  name: 'Tree',
467
- spawn: position => ({ object: new Tree(position) }),
483
+ spawn: position => ({
484
+ object: new Tree(position)
485
+ }),
468
486
  })
469
487
  },
470
488
  update(delta, ctx) {},
@@ -494,6 +512,112 @@ export default defineServerPlugin({
494
512
 
495
513
  A hook that throws is logged and turned off for that plugin, and the game keeps running.
496
514
 
515
+ ### Graphs and nodes
516
+
517
+ A plugin can ship material and logic graphs: put `<name>.graph.json` files (made in the editor's Graphs view, then copied over) in a `graphs/` directory in the package. They go by `<package>:<name>`, e.g. `my-custom-plugin:ocean`, wherever a graph is picked: a primitive's material graph, a Logic Graph object's graph. They are served at `/graphs/<package>/<name>.graph.json`, shipped in every release, and the server reads them from the package. The editor lists them under the project's graphs, read-only: *Copy to project* makes an editable copy.
518
+
519
+ It can also add node types, from `setup`. Their key in graph files is `<package>:<type>`, which `registerNode` returns. Material nodes take their TSL implementation as a second argument; logic nodes need registering in the server entry too, for graphs that run there:
520
+
521
+ ```ts
522
+ // client.ts
523
+ import { defineClientPlugin } from '@mavonengine/core/Plugins/types'
524
+ import { sin, time } from 'three/tsl'
525
+
526
+ export default defineClientPlugin({
527
+ setup(ctx) {
528
+ ctx.registerNode({
529
+ type: 'wobble',
530
+ label: 'Wobble',
531
+ category: 'Math',
532
+ kinds: ['material', 'logic'],
533
+ inputs: {
534
+ speed: { type: 'float', default: 1 }
535
+ },
536
+ outputs: {
537
+ value: { type: 'float' }
538
+ },
539
+ // In logic graphs
540
+ eval: ({ speed }, { time }) => ({
541
+ value: Math.sin(time * Number(speed))
542
+ }),
543
+ }, ({ speed }) => ({
544
+ value: sin(time.mul(speed))
545
+ }))
546
+ },
547
+ })
548
+ ```
549
+
550
+ ### Dev entries
551
+
552
+ A plugin's `dev` entry runs in the client's Vite dev server, only in dev: tooling for the editor that has to work with the project's files, like downloading something and writing it into `client/public/`. It is never part of a build, and the game server never loads it.
553
+
554
+ ```ts
555
+ // dev.ts
556
+ import { mkdirSync } from 'node:fs'
557
+ import { defineDevPlugin } from '@mavonengine/core/Plugins/types'
558
+
559
+ export default defineDevPlugin({
560
+ setup(ctx) {
561
+ mkdirSync(ctx.dataDir, { recursive: true })
562
+ },
563
+ // Answers under /__mavonengine/plugins/<package>/, with that prefix taken off req.url
564
+ middleware: ctx => (req, res, next) => {
565
+ if (req.url !== '/status')
566
+ return next() // 404
567
+ res.setHeader('Content-Type', 'application/json')
568
+ res.end(JSON.stringify({ options: ctx.options }))
569
+ },
570
+ destroy(ctx) {},
571
+ })
572
+ ```
573
+
574
+ The client side calls it with `` fetch(`${devPluginBase(ctx.package)}status`) ``, using `devPluginBase` from `@mavonengine/core/Plugins/types`. Only requests from localhost reach the middleware, and requests that change something (anything but GET and HEAD) only when they come from the game's own page, so another site open in the browser can't make them. Paths in `req.url` come from the browser: resolve them with `resolveInside()` from `@mavonengine/core/Plugins/ProjectConfig` before reading or writing files.
575
+
576
+ The context has `package`, `options` (read from `mavonengine.json` on every access), `projectRoot`, `clientRoot`, `publicDir`, `logger`, and:
577
+
578
+ - `dataDir`: `.mavonengine/plugins/<package>/` in the project, for downloads and caches. The project's `.gitignore` leaves out `.mavonengine`, so nothing there is committed or shipped.
579
+ - `updateOptions(change)`: changes the plugin's `options` in `mavonengine.json`. Use it to record what should be committed with the project.
580
+
581
+ A dev entry can also give AI assistants tools, which [`mavonengine mcp`](#mavonengine-mcp) offers as `<plugin>_<tool>`: the package name without its scope, then the tool's name.
582
+
583
+ ```ts
584
+ export default defineDevPlugin({
585
+ mcpTools: ctx => [
586
+ {
587
+ name: 'add_tree', // my-plugin_add_tree
588
+ title: 'Add a tree',
589
+ description: 'Adds a tree to the list in the plugin\'s options. Use it when the user asks for more trees',
590
+ input: {
591
+ type: 'object',
592
+ properties: {
593
+ kind: {
594
+ type: 'string',
595
+ enum: ['pine', 'oak']
596
+ }
597
+ },
598
+ required: ['kind']
599
+ },
600
+ run: ({ kind }) => {
601
+ ctx.updateOptions((options) => {
602
+ options.trees = [
603
+ ...(options.trees as string[] ?? []),
604
+ kind
605
+ ]
606
+ })
607
+ return { trees: ctx.options.trees }
608
+ },
609
+ },
610
+ ],
611
+ })
612
+ ```
613
+
614
+ - `input` is the JSON Schema of the arguments, an object; `mavonengine mcp` turns away calls that don't match it. The arguments still come from a model, so check them in `run()` as you would any input, e.g. paths with `resolveInside()`.
615
+ - What `run()` returns goes to the assistant as JSON. What it throws is reported as the tool's error.
616
+ - Set `readOnly: true` on tools that change nothing; the rest are taken to change something, so assistants ask first and `mavonengine mcp --read-only` leaves them out. `destructive: true` marks one that deletes or overwrites what can't be had back, `openWorld: true` one that reaches outside the project, e.g. a website.
617
+ - The dev server lists them on `GET /__mavonengine/mcp/tools` and runs them on `POST /__mavonengine/mcp/tools/<name>` with `{ "arguments": … }`, only for requests from this machine and never for another site open in the browser.
618
+
619
+ Dev entries start with the dev server and restart when plugins are added, removed, turned on or off in `mavonengine.json`. Changing options doesn't restart them. One that fails to start is logged, and its URLs answer 404 with the reason.
620
+
497
621
  Guard a plugin's admin routes with `ctx.requireAdmin`, which asks for the server's [admin token](#admin-token), instead of giving the plugin a token of its own:
498
622
 
499
623
  ```ts
@@ -519,12 +643,20 @@ export default defineServerPlugin({
519
643
  icon: 'chat', // dashboard, activity, routes, plugin, database, users, logs, settings, chart, mail, chat, bell or lock
520
644
  children: [
521
645
  { label: 'Live', href: '#live' }, // an anchor on the page
522
- { label: 'Mutes', href: 'mutes', render: () => '<p>…</p>' }, // a sub page, /admin/chat/mutes/
646
+ {
647
+ label: 'Mutes',
648
+ href: 'mutes',
649
+ render: () => '<p>…</p>'
650
+ }, // a sub page, /admin/chat/mutes/
523
651
  ],
524
652
  render: req => ({
525
653
  html: '<div class="adm-page">…</div>',
526
- styles: [ctx.admin.url('chat/style.css')],
527
- scripts: [ctx.admin.url('chat/app.js')],
654
+ styles: [
655
+ ctx.admin.url('chat/style.css')
656
+ ],
657
+ scripts: [
658
+ ctx.admin.url('chat/app.js')
659
+ ],
528
660
  }),
529
661
  })
530
662
 
@@ -547,7 +679,9 @@ An auth plugin decides who may connect, before a client gets a player. [`@mavone
547
679
  export default defineClientPlugin({
548
680
  authorization: () => {
549
681
  const token = localStorage.getItem('session')
550
- return token ? `Bearer ${token}` : undefined
682
+ return token
683
+ ? `Bearer ${token}`
684
+ : undefined
551
685
  },
552
686
  })
553
687
  ```
@@ -586,7 +720,9 @@ Game.usePlugins(plugins)
586
720
 
587
721
  ```ts
588
722
  // server: the directory with mavonengine.json
589
- const server = new MyServer(logger, physicsWorld, { plugins: { root: projectRoot } })
723
+ const server = new MyServer(logger, physicsWorld, {
724
+ plugins: { root: projectRoot }
725
+ })
590
726
  await server.start()
591
727
  ```
592
728
 
@@ -22,15 +22,17 @@ function normalizeRegistry(raw, url) {
22
22
  if (!pkg)
23
23
  return [];
24
24
  const target = plugin.target === "client" || plugin.target === "server" || plugin.target === "both" ? plugin.target : void 0;
25
- return [{
26
- package: pkg,
27
- name: text(plugin.name) ?? pkg,
28
- description: text(plugin.description),
29
- target,
30
- engine: text(plugin.engine),
31
- homepage: text(plugin.homepage),
32
- readme: text(plugin.readme)
33
- }];
25
+ return [
26
+ {
27
+ package: pkg,
28
+ name: text(plugin.name) ?? pkg,
29
+ description: text(plugin.description),
30
+ target,
31
+ engine: text(plugin.engine),
32
+ homepage: text(plugin.homepage),
33
+ readme: text(plugin.readme)
34
+ }
35
+ ];
34
36
  })
35
37
  };
36
38
  }
@@ -46,12 +48,16 @@ async function fetchPluginReadme(plugin, { timeoutMs = 1e4, fetch = globalThis.f
46
48
  throw new PluginRegistryError(`The list has no readme for ${plugin.package}`);
47
49
  let res;
48
50
  try {
49
- res = await fetch(url, { cache: "no-store", signal: AbortSignal.timeout(timeoutMs) });
51
+ res = await fetch(url, {
52
+ cache: "no-store",
53
+ signal: AbortSignal.timeout(timeoutMs)
54
+ });
50
55
  } catch (err) {
51
56
  throw new PluginRegistryError(`Can't reach ${url}: ${err.message}`);
52
57
  }
53
- if (!res.ok)
58
+ if (!res.ok) {
54
59
  throw new PluginRegistryError(res.status === 404 ? `${url} was not found` : `${url} answered ${res.status} ${res.statusText}`);
60
+ }
55
61
  const markdown = await res.text();
56
62
  return markdown.length > MAX_REMOTE_README_CHARS ? `${markdown.slice(0, MAX_REMOTE_README_CHARS)}
57
63
 
@@ -60,7 +66,10 @@ async function fetchPluginReadme(plugin, { timeoutMs = 1e4, fetch = globalThis.f
60
66
  async function fetchPluginRegistry({ url = PLUGIN_REGISTRY_URL, timeoutMs = 1e4, fetch = globalThis.fetch } = {}) {
61
67
  let res;
62
68
  try {
63
- res = await fetch(url, { cache: "no-store", signal: AbortSignal.timeout(timeoutMs) });
69
+ res = await fetch(url, {
70
+ cache: "no-store",
71
+ signal: AbortSignal.timeout(timeoutMs)
72
+ });
64
73
  } catch (err) {
65
74
  throw new PluginRegistryError(`Can't reach ${url}: ${err.message}`);
66
75
  }
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, { get: all[name], enumerable: true });
6
+ };
7
+
8
+ export {
9
+ __export
10
+ };
@@ -1,12 +1,7 @@
1
1
  #!/usr/bin/env node
2
- var __defProp = Object.defineProperty;
3
- var __export = (target, all) => {
4
- for (var name in all)
5
- __defProp(target, name, { get: all[name], enumerable: true });
6
- };
7
2
 
8
3
  // package.json
9
- var version = "0.0.7";
4
+ var version = "0.0.9";
10
5
 
11
6
  // src/mcp/config.ts
12
7
  import { existsSync, readFileSync, writeFileSync } from "fs";
@@ -35,14 +30,16 @@ function writeMcpConfig(dir) {
35
30
  const servers = config.mcpServers && typeof config.mcpServers === "object" ? config.mcpServers : {};
36
31
  if (MCP_SERVER_NAME in servers)
37
32
  return false;
38
- config.mcpServers = { ...servers, [MCP_SERVER_NAME]: mcpServerEntry() };
33
+ config.mcpServers = {
34
+ ...servers,
35
+ [MCP_SERVER_NAME]: mcpServerEntry()
36
+ };
39
37
  writeFileSync(file, `${JSON.stringify(config, null, 2)}
40
38
  `);
41
39
  return true;
42
40
  }
43
41
 
44
42
  export {
45
- __export,
46
43
  version,
47
44
  DEFAULT_DOCS_URL,
48
45
  MCP_CONFIG_FILE,
@@ -2,29 +2,14 @@
2
2
  import {
3
3
  DEFAULT_DOCS_URL,
4
4
  version
5
- } from "./chunk-3VVGSO5T.js";
5
+ } from "./chunk-KNBPVBMA.js";
6
+ import {
7
+ READ_ONLY
8
+ } from "./chunk-WMXVMJDM.js";
6
9
 
7
10
  // src/mcp/docs.ts
8
11
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
9
- import { z as z2 } from "zod";
10
-
11
- // src/mcp/result.ts
12
12
  import { z } from "zod";
13
- var READ_ONLY = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
14
- var LOG_LEVELS = ["error", "warn", "info", "http", "verbose", "debug", "silly"];
15
- var vec3 = z.object({ x: z.number(), y: z.number(), z: z.number() });
16
- function json(data) {
17
- return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
18
- }
19
- async function run(body) {
20
- try {
21
- return json(await body());
22
- } catch (err) {
23
- return { isError: true, content: [{ type: "text", text: err.message }] };
24
- }
25
- }
26
-
27
- // src/mcp/docs.ts
28
13
  var REQUEST_TIMEOUT_MS = 15e3;
29
14
  var DocsClient = class {
30
15
  constructor(url = DEFAULT_DOCS_URL, connect = connectHttp) {
@@ -65,7 +50,12 @@ function registerDocsTools(server, docs) {
65
50
  try {
66
51
  return await docs.call(tool, args);
67
52
  } catch (err) {
68
- return { isError: true, content: [{ type: "text", text: err.message }] };
53
+ return {
54
+ isError: true,
55
+ content: [
56
+ { type: "text", text: err.message }
57
+ ]
58
+ };
69
59
  }
70
60
  };
71
61
  server.registerTool("docs_list_pages", {
@@ -76,16 +66,14 @@ function registerDocsTools(server, docs) {
76
66
  server.registerTool("docs_get_page", {
77
67
  title: "Read a MavonEngine docs page",
78
68
  description: "One page of the MavonEngine documentation as Markdown, by its path from docs_list_pages (e.g. /networking/state-sync).",
79
- inputSchema: { path: z2.string().min(1).describe("Page path, e.g. /getting-started/installation") },
69
+ inputSchema: {
70
+ path: z.string().min(1).describe("Page path, e.g. /getting-started/installation")
71
+ },
80
72
  annotations: { ...READ_ONLY, openWorldHint: true }
81
73
  }, ({ path }) => forward("get-page", { path }));
82
74
  }
83
75
 
84
76
  export {
85
- READ_ONLY,
86
- LOG_LEVELS,
87
- vec3,
88
- run,
89
77
  DocsClient,
90
78
  registerDocsTools
91
79
  };
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/mcp/result.ts
4
+ import { z } from "zod";
5
+ var READ_ONLY = {
6
+ readOnlyHint: true,
7
+ destructiveHint: false,
8
+ idempotentHint: true,
9
+ openWorldHint: false
10
+ };
11
+ var LOG_LEVELS = [
12
+ "error",
13
+ "warn",
14
+ "info",
15
+ "http",
16
+ "verbose",
17
+ "debug",
18
+ "silly"
19
+ ];
20
+ var vec3 = z.object({
21
+ x: z.number(),
22
+ y: z.number(),
23
+ z: z.number()
24
+ });
25
+ function json(data) {
26
+ return {
27
+ content: [
28
+ {
29
+ type: "text",
30
+ text: JSON.stringify(data, null, 2)
31
+ }
32
+ ]
33
+ };
34
+ }
35
+ async function run(body) {
36
+ try {
37
+ return json(await body());
38
+ } catch (err) {
39
+ return {
40
+ isError: true,
41
+ content: [
42
+ { type: "text", text: err.message }
43
+ ]
44
+ };
45
+ }
46
+ }
47
+
48
+ export {
49
+ READ_ONLY,
50
+ LOG_LEVELS,
51
+ vec3,
52
+ run
53
+ };
@@ -2,10 +2,12 @@
2
2
  import {
3
3
  DocsClient,
4
4
  registerDocsTools
5
- } from "./chunk-5YUDR7ZR.js";
5
+ } from "./chunk-UD5YAJCQ.js";
6
6
  import {
7
7
  DEFAULT_DOCS_URL
8
- } from "./chunk-3VVGSO5T.js";
8
+ } from "./chunk-KNBPVBMA.js";
9
+ import "./chunk-WMXVMJDM.js";
10
+ import "./chunk-K3NQKI34.js";
9
11
  export {
10
12
  DEFAULT_DOCS_URL,
11
13
  DocsClient,