@ait-co/devtools 0.1.52 → 0.1.53

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/mcp/cli.js CHANGED
@@ -3092,19 +3092,26 @@ var InMemoryDiagnosticsCollector = class {
3092
3092
  }
3093
3093
  };
3094
3094
  /**
3095
- * Reads the `@modelcontextprotocol/sdk` package version from the installed
3096
- * package's `package.json`. Returns `null` on any error (missing file, JSON
3097
- * parse failure, etc.) diagnostics must never throw.
3098
- *
3099
- * Node-only — uses dynamic `import()` so it does not pollute the browser
3100
- * module graph.
3095
+ * Returns the `@modelcontextprotocol/sdk` version baked in at build time via
3096
+ * the `__MCP_SDK_VERSION__` define (see `tsdown.config.ts`). Returns `null`
3097
+ * when the define is absent (unbundled test runs) and the runtime fallback
3098
+ * below also fails — diagnostics must never throw.
3099
+ *
3100
+ * The old implementation resolved `@modelcontextprotocol/sdk/package.json` at
3101
+ * runtime, but that subpath is NOT in the SDK's `exports` map, so the resolve
3102
+ * threw `ERR_PACKAGE_PATH_NOT_EXPORTED` and this always returned `null` in a
3103
+ * real bundle (issue #361). The build-time define sidesteps the exports gate.
3104
+ *
3105
+ * Kept `async` for call-site compatibility (`Promise.all` at the caller); the
3106
+ * body is synchronous apart from the best-effort fallback.
3101
3107
  */
3102
3108
  async function readMcpSdkVersion() {
3103
3109
  try {
3104
3110
  const { createRequire } = await import("node:module");
3105
- const pkgPath = createRequire(import.meta.url).resolve("@modelcontextprotocol/sdk/package.json");
3111
+ const entry = createRequire(import.meta.url).resolve("@modelcontextprotocol/sdk");
3112
+ const root = entry.slice(0, entry.indexOf("@modelcontextprotocol/sdk") + 25);
3106
3113
  const { readFileSync } = await import("node:fs");
3107
- const raw = readFileSync(pkgPath, "utf8");
3114
+ const raw = readFileSync(`${root}/package.json`, "utf8");
3108
3115
  const parsed = JSON.parse(raw);
3109
3116
  return typeof parsed.version === "string" ? parsed.version : null;
3110
3117
  } catch {
@@ -3117,12 +3124,7 @@ async function readMcpSdkVersion() {
3117
3124
  * some test environments that skip the build step).
3118
3125
  */
3119
3126
  function readDevtoolsVersion() {
3120
- try {
3121
- const v = globalThis.__VERSION__;
3122
- return typeof v === "string" && v.length > 0 ? v : null;
3123
- } catch {
3124
- return null;
3125
- }
3127
+ return "0.1.53";
3126
3128
  }
3127
3129
  /**
3128
3130
  * Derives the next recommended action from a completed diagnostics snapshot.
@@ -3604,7 +3606,7 @@ function createDebugServer(deps) {
3604
3606
  const collector = collectorDep ?? new InMemoryDiagnosticsCollector();
3605
3607
  const server = new Server({
3606
3608
  name: "ait-debug",
3607
- version: "0.1.52"
3609
+ version: "0.1.53"
3608
3610
  }, { capabilities: { tools: { listChanged: true } } });
3609
3611
  server.setRequestHandler(ListToolsRequestSchema, () => {
3610
3612
  const conn = router.active;
@@ -4991,7 +4993,7 @@ function createDevServer(deps = {}) {
4991
4993
  const aitSource = deps.aitSource ?? new HttpAitSource({ stateEndpoint });
4992
4994
  const server = new Server({
4993
4995
  name: "ait-devtools",
4994
- version: "0.1.52"
4996
+ version: "0.1.53"
4995
4997
  }, { capabilities: { tools: {} } });
4996
4998
  server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: DEV_TOOL_DEFINITIONS.map((tool) => ({ ...tool })) }));
4997
4999
  server.setRequestHandler(CallToolRequestSchema, async (request) => {