nulladrift 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/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1445,7 +1445,7 @@ import { dirname, join as join2 } from "path";
|
|
|
1445
1445
|
import { ClientCredentialsProvider, UnauthorizedError } from "@modelcontextprotocol/client";
|
|
1446
1446
|
|
|
1447
1447
|
// src/lib/version.ts
|
|
1448
|
-
var VERSION = "0.3.
|
|
1448
|
+
var VERSION = "0.3.2";
|
|
1449
1449
|
var USER_AGENT = `nulladrift/${VERSION}`;
|
|
1450
1450
|
|
|
1451
1451
|
// src/mcp/oauth.ts
|
|
@@ -1722,11 +1722,38 @@ async function connect(server2, timeoutMs = DEFAULT_TIMEOUT_MS, options = {}) {
|
|
|
1722
1722
|
|
|
1723
1723
|
// src/mcp/capture.ts
|
|
1724
1724
|
var FRESH = { cacheMode: "bypass" };
|
|
1725
|
+
function describeValidationIssues(message) {
|
|
1726
|
+
const start = message.indexOf("[");
|
|
1727
|
+
if (start < 0) return void 0;
|
|
1728
|
+
let issues;
|
|
1729
|
+
try {
|
|
1730
|
+
issues = JSON.parse(message.slice(start));
|
|
1731
|
+
} catch {
|
|
1732
|
+
return void 0;
|
|
1733
|
+
}
|
|
1734
|
+
if (!Array.isArray(issues) || issues.length === 0) return void 0;
|
|
1735
|
+
const where = (issue) => (issue.path ?? []).map((part) => typeof part === "number" ? `[${part}]` : `.${String(part)}`).join("").replace(/^\./, "");
|
|
1736
|
+
const byMessage = /* @__PURE__ */ new Map();
|
|
1737
|
+
for (const issue of issues) {
|
|
1738
|
+
const text = issue.message ?? "did not validate";
|
|
1739
|
+
byMessage.set(text, [...byMessage.get(text) ?? [], where(issue)]);
|
|
1740
|
+
}
|
|
1741
|
+
const lines = [...byMessage].slice(0, 3).map(([text, paths]) => {
|
|
1742
|
+
const rest = paths.length > 1 ? ` (and ${paths.length - 1} more like it)` : "";
|
|
1743
|
+
return `${paths[0]}: ${text}${rest}`;
|
|
1744
|
+
});
|
|
1745
|
+
const more = byMessage.size > 3 ? ` +${byMessage.size - 3} other problem(s)` : "";
|
|
1746
|
+
return `this server's reply does not match the MCP specification, so nothing was pinned for it. ${lines.join("; ")}${more}. This is a defect in the server, not in your project; the usual cause is an old release predating a tightening of the schema.`;
|
|
1747
|
+
}
|
|
1725
1748
|
function describeListFailure(error) {
|
|
1726
1749
|
const message = error?.message ?? String(error);
|
|
1727
1750
|
if (error instanceof RangeError || /maximum call stack|stack size exceeded|too much recursion/i.test(message)) {
|
|
1728
1751
|
return "the declared surface is nested too deeply to parse. Nothing was pinned. A legitimate schema is a few levels deep; this one is deep enough to exhaust the parser, which is a property of the declaration and not of your project.";
|
|
1729
1752
|
}
|
|
1753
|
+
if (/invalid result for|invalid literal|invalid_value|invalid_type/i.test(message)) {
|
|
1754
|
+
const described = describeValidationIssues(message);
|
|
1755
|
+
if (described) return described;
|
|
1756
|
+
}
|
|
1730
1757
|
return message;
|
|
1731
1758
|
}
|
|
1732
1759
|
async function listOrEmpty(label, serverName, fetchList) {
|