@sanity-labs/nuum 0.2.1 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +46 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -44301,7 +44301,10 @@ var Mcp;
44301
44301
  headers: exports_external.record(exports_external.string()).optional(),
44302
44302
  transport: exports_external.enum(["http", "sse"]).optional().default("http"),
44303
44303
  disabled: exports_external.boolean().optional().default(false),
44304
- timeout: exports_external.number().optional().default(30000)
44304
+ timeout: exports_external.number().optional().default(30000),
44305
+ maxRetries: exports_external.number().optional().default(5),
44306
+ initialReconnectionDelay: exports_external.number().optional().default(1000),
44307
+ maxReconnectionDelay: exports_external.number().optional().default(60000)
44305
44308
  });
44306
44309
  Mcp.ServerConfigSchema = exports_external.union([
44307
44310
  Mcp.StdioServerConfigSchema,
@@ -44359,7 +44362,13 @@ var Mcp;
44359
44362
  });
44360
44363
  } else {
44361
44364
  return new StreamableHTTPClientTransport(new URL(config2.url), {
44362
- requestInit: config2.headers ? { headers: config2.headers } : undefined
44365
+ requestInit: config2.headers ? { headers: config2.headers } : undefined,
44366
+ reconnectionOptions: {
44367
+ maxRetries: config2.maxRetries ?? 5,
44368
+ initialReconnectionDelay: config2.initialReconnectionDelay ?? 1000,
44369
+ maxReconnectionDelay: config2.maxReconnectionDelay ?? 60000,
44370
+ reconnectionDelayGrowFactor: 1.5
44371
+ }
44363
44372
  });
44364
44373
  }
44365
44374
  }
@@ -44390,13 +44399,24 @@ var Mcp;
44390
44399
  ]);
44391
44400
  const toolsResult = await client.listTools();
44392
44401
  const tools = toolsResult.tools;
44393
- console.error(`[mcp:${name17}] Connected, ${tools.length} tools available`);
44402
+ let sessionId;
44403
+ if (transport instanceof StreamableHTTPClientTransport) {
44404
+ sessionId = transport.sessionId;
44405
+ if (sessionId) {
44406
+ console.error(`[mcp:${name17}] Connected with session ${sessionId.slice(0, 8)}..., ${tools.length} tools available`);
44407
+ } else {
44408
+ console.error(`[mcp:${name17}] Connected (no session), ${tools.length} tools available`);
44409
+ }
44410
+ } else {
44411
+ console.error(`[mcp:${name17}] Connected, ${tools.length} tools available`);
44412
+ }
44394
44413
  return {
44395
44414
  name: name17,
44396
44415
  config: config2,
44397
44416
  client,
44398
44417
  tools,
44399
- status: "connected"
44418
+ status: "connected",
44419
+ sessionId
44400
44420
  };
44401
44421
  } catch (e) {
44402
44422
  const error2 = e instanceof Error ? e.message : String(e);
@@ -44463,16 +44483,28 @@ var Mcp;
44463
44483
  description: mcpTool.description ?? `MCP tool: ${mcpTool.name}`,
44464
44484
  parameters: jsonSchema(mcpTool.inputSchema),
44465
44485
  execute: async (args) => {
44466
- const result = await client.callTool({
44467
- name: mcpTool.name,
44468
- arguments: args
44469
- });
44470
- if ("content" in result && Array.isArray(result.content)) {
44471
- const textParts = result.content.filter((c) => c.type === "text").map((c) => c.text);
44472
- return textParts.join(`
44486
+ try {
44487
+ const result = await client.callTool({
44488
+ name: mcpTool.name,
44489
+ arguments: args
44490
+ });
44491
+ if ("isError" in result && result.isError) {
44492
+ const content = "content" in result && Array.isArray(result.content) ? result.content : [];
44493
+ const errorContent = content.filter((c) => c.type === "text").map((c) => c.text).join(`
44473
44494
  `);
44495
+ return `Error: ${errorContent || "Tool execution failed"}`;
44496
+ }
44497
+ if ("content" in result && Array.isArray(result.content)) {
44498
+ const textParts = result.content.filter((c) => c.type === "text").map((c) => c.text);
44499
+ return textParts.join(`
44500
+ `);
44501
+ }
44502
+ return JSON.stringify(result);
44503
+ } catch (error2) {
44504
+ const message = error2 instanceof Error ? error2.message : String(error2);
44505
+ console.error(`[mcp:${serverName}] Tool ${mcpTool.name} failed: ${message}`);
44506
+ return `Error: MCP tool call failed - ${message}. The server may be temporarily unavailable.`;
44474
44507
  }
44475
- return JSON.stringify(result);
44476
44508
  }
44477
44509
  });
44478
44510
  }
@@ -47376,8 +47408,8 @@ async function runRepl(options) {
47376
47408
  }
47377
47409
 
47378
47410
  // src/version.ts
47379
- var VERSION = "0.2.1";
47380
- var GIT_HASH = "73e0b24";
47411
+ var VERSION = "0.2.2";
47412
+ var GIT_HASH = "0764a52";
47381
47413
  var VERSION_STRING = `miriad-code v${VERSION} (${GIT_HASH})`;
47382
47414
 
47383
47415
  // src/cli/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity-labs/nuum",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "AI coding agent with continuous memory - infinite context across sessions",
5
5
  "type": "module",
6
6
  "bin": {