@sanity-labs/nuum 0.5.2 → 0.5.3

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.
Files changed (2) hide show
  1. package/dist/index.js +76 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -45086,6 +45086,30 @@ var Mcp;
45086
45086
  function isHttpConfig(config2) {
45087
45087
  return "url" in config2;
45088
45088
  }
45089
+ const TOOL_NAME_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/;
45090
+ function validateToolName(serverName, mcpToolName) {
45091
+ const effectiveName = `${serverName}__${mcpToolName}`;
45092
+ if (TOOL_NAME_PATTERN.test(effectiveName)) {
45093
+ return null;
45094
+ }
45095
+ const invalidChars = effectiveName.split("").filter((c) => !/[a-zA-Z0-9_-]/.test(c));
45096
+ const uniqueInvalid = Array.from(new Set(invalidChars));
45097
+ let message;
45098
+ if (effectiveName.length > 64) {
45099
+ message = `Effective tool name "${effectiveName}" exceeds 64 character limit (${effectiveName.length} chars)`;
45100
+ } else if (effectiveName.length === 0) {
45101
+ message = `Tool name is empty`;
45102
+ } else {
45103
+ message = `Effective tool name "${effectiveName}" contains invalid character(s): ${uniqueInvalid.map((c) => `"${c}"`).join(", ")} (allowed: a-z, A-Z, 0-9, _, -)`;
45104
+ }
45105
+ return {
45106
+ type: "invalid_tool_name",
45107
+ tool: mcpToolName,
45108
+ effectiveName,
45109
+ message
45110
+ };
45111
+ }
45112
+ Mcp.validateToolName = validateToolName;
45089
45113
 
45090
45114
  class Manager {
45091
45115
  servers = new Map;
@@ -45124,6 +45148,8 @@ var Mcp;
45124
45148
  config: config2,
45125
45149
  client: null,
45126
45150
  tools: [],
45151
+ allToolCount: 0,
45152
+ issues: [],
45127
45153
  status: "disabled"
45128
45154
  };
45129
45155
  }
@@ -45141,24 +45167,38 @@ var Mcp;
45141
45167
  new Promise((_, reject) => setTimeout(() => reject(new Error("Connection timeout")), timeoutMs))
45142
45168
  ]);
45143
45169
  const toolsResult = await client.listTools();
45144
- const tools = toolsResult.tools;
45170
+ const allTools = toolsResult.tools;
45171
+ const validTools = [];
45172
+ const issues = [];
45173
+ for (const mcpTool of allTools) {
45174
+ const issue2 = validateToolName(name17, mcpTool.name);
45175
+ if (issue2) {
45176
+ issues.push(issue2);
45177
+ console.error(`[mcp:${name17}] Skipping tool "${mcpTool.name}": ${issue2.message}`);
45178
+ } else {
45179
+ validTools.push(mcpTool);
45180
+ }
45181
+ }
45145
45182
  let sessionId;
45146
45183
  if (transport instanceof StreamableHTTPClientTransport) {
45147
45184
  sessionId = transport.sessionId;
45148
45185
  if (sessionId) {
45149
- console.error(`[mcp:${name17}] Connected with session ${sessionId.slice(0, 8)}..., ${tools.length} tools available`);
45186
+ console.error(`[mcp:${name17}] Connected with session ${sessionId.slice(0, 8)}..., ${validTools.length}/${allTools.length} tools available`);
45150
45187
  } else {
45151
- console.error(`[mcp:${name17}] Connected (no session), ${tools.length} tools available`);
45188
+ console.error(`[mcp:${name17}] Connected (no session), ${validTools.length}/${allTools.length} tools available`);
45152
45189
  }
45153
45190
  } else {
45154
- console.error(`[mcp:${name17}] Connected, ${tools.length} tools available`);
45191
+ console.error(`[mcp:${name17}] Connected, ${validTools.length}/${allTools.length} tools available`);
45155
45192
  }
45193
+ const status = issues.length > 0 ? "degraded" : "connected";
45156
45194
  return {
45157
45195
  name: name17,
45158
45196
  config: config2,
45159
45197
  client,
45160
- tools,
45161
- status: "connected",
45198
+ tools: validTools,
45199
+ allToolCount: allTools.length,
45200
+ issues,
45201
+ status,
45162
45202
  sessionId
45163
45203
  };
45164
45204
  } catch (e) {
@@ -45169,6 +45209,8 @@ var Mcp;
45169
45209
  config: config2,
45170
45210
  client,
45171
45211
  tools: [],
45212
+ allToolCount: 0,
45213
+ issues: [],
45172
45214
  status: "failed",
45173
45215
  error: error2
45174
45216
  };
@@ -45185,10 +45227,18 @@ var Mcp;
45185
45227
  this.servers.set(server.name, server);
45186
45228
  }
45187
45229
  const connected = results.filter((s) => s.status === "connected").length;
45230
+ const degraded = results.filter((s) => s.status === "degraded").length;
45188
45231
  const failed = results.filter((s) => s.status === "failed").length;
45189
45232
  const disabled = results.filter((s) => s.status === "disabled").length;
45190
45233
  if (entries.length > 0) {
45191
- console.error(`[mcp] Initialized: ${connected} connected, ${failed} failed, ${disabled} disabled`);
45234
+ const parts = [`${connected} connected`];
45235
+ if (degraded > 0)
45236
+ parts.push(`${degraded} degraded`);
45237
+ if (failed > 0)
45238
+ parts.push(`${failed} failed`);
45239
+ if (disabled > 0)
45240
+ parts.push(`${disabled} disabled`);
45241
+ console.error(`[mcp] Initialized: ${parts.join(", ")}`);
45192
45242
  }
45193
45243
  }
45194
45244
  async shutdown() {
@@ -45206,14 +45256,16 @@ var Mcp;
45206
45256
  return Array.from(this.servers.values()).map((s) => ({
45207
45257
  name: s.name,
45208
45258
  status: s.status,
45209
- toolCount: s.tools.length,
45259
+ toolCount: s.allToolCount,
45260
+ activeToolCount: s.tools.length,
45261
+ issues: s.issues,
45210
45262
  error: s.error
45211
45263
  }));
45212
45264
  }
45213
45265
  listTools() {
45214
45266
  const tools = [];
45215
45267
  for (const [serverName, server] of this.servers) {
45216
- if (server.status !== "connected")
45268
+ if (server.status !== "connected" && server.status !== "degraded")
45217
45269
  continue;
45218
45270
  for (const mcpTool of server.tools) {
45219
45271
  tools.push(`${serverName}__${mcpTool.name}`);
@@ -45254,7 +45306,7 @@ var Mcp;
45254
45306
  getTools() {
45255
45307
  const tools = {};
45256
45308
  for (const [serverName, server] of this.servers) {
45257
- if (server.status !== "connected")
45309
+ if (server.status !== "connected" && server.status !== "degraded")
45258
45310
  continue;
45259
45311
  for (const mcpTool of server.tools) {
45260
45312
  const toolName = `${serverName}__${mcpTool.name}`;
@@ -45319,8 +45371,8 @@ var Mcp;
45319
45371
  })(Mcp ||= {});
45320
45372
 
45321
45373
  // src/version.ts
45322
- var VERSION = "0.5.2";
45323
- var GIT_HASH = "91ca6b6";
45374
+ var VERSION = "0.5.3";
45375
+ var GIT_HASH = "a2a5ddc";
45324
45376
  var VERSION_STRING = `nuum v${VERSION} (${GIT_HASH})`;
45325
45377
 
45326
45378
  // src/tool/mcp-status.ts
@@ -45369,14 +45421,23 @@ Use this when:
45369
45421
  } else {
45370
45422
  let connectedCount = 0;
45371
45423
  for (const server of mcpStatus) {
45372
- const statusIcon = server.status === "connected" ? "\u2713" : server.status === "connecting" ? "\u22EF" : "\u2717";
45424
+ const statusIcon = server.status === "connected" ? "\u2713" : server.status === "degraded" ? "\u26A0" : server.status === "connecting" ? "\u22EF" : "\u2717";
45373
45425
  output += `**${server.name}** ${statusIcon}
45374
45426
  `;
45375
- if (server.status === "connected") {
45427
+ if (server.status === "connected" || server.status === "degraded") {
45376
45428
  connectedCount++;
45377
45429
  const serverTools = mcpToolNames.filter((t) => t.startsWith(`${server.name}__`));
45378
- output += `- ${server.toolCount} tools: ${serverTools.map((t) => t.replace(`${server.name}__`, "")).join(", ")}
45430
+ if (server.status === "degraded") {
45431
+ output += `- ${server.activeToolCount}/${server.toolCount} tools active: ${serverTools.map((t) => t.replace(`${server.name}__`, "")).join(", ")}
45379
45432
  `;
45433
+ for (const issue2 of server.issues) {
45434
+ output += ` - \u26A0 Skipped "${issue2.tool}": ${issue2.message}
45435
+ `;
45436
+ }
45437
+ } else {
45438
+ output += `- ${server.toolCount} tools: ${serverTools.map((t) => t.replace(`${server.name}__`, "")).join(", ")}
45439
+ `;
45440
+ }
45380
45441
  } else if (server.error) {
45381
45442
  output += `- Error: ${server.error}
45382
45443
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity-labs/nuum",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "AI coding agent with continuous memory - infinite context across sessions",
5
5
  "type": "module",
6
6
  "bin": {