zam-core 0.10.7 → 0.10.8

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.
@@ -9913,7 +9913,7 @@ async function readWebLink(url) {
9913
9913
  redirect: "manual",
9914
9914
  signal: controller.signal,
9915
9915
  headers: {
9916
- "User-Agent": "ZAM-Content-Studio/0.10.7"
9916
+ "User-Agent": "ZAM-Content-Studio/0.10.8"
9917
9917
  }
9918
9918
  });
9919
9919
  if (res.status >= 300 && res.status < 400) {
@@ -10418,17 +10418,21 @@ function connectHarnessMcp(harnessId, opts) {
10418
10418
  if (!existing.mcpServers) {
10419
10419
  existing.mcpServers = {};
10420
10420
  }
10421
- if (opts.zamPath.endsWith(".js")) {
10422
- existing.mcpServers.zam = {
10423
- command: process.execPath,
10424
- args: [opts.zamPath, "mcp"]
10425
- };
10426
- } else {
10427
- existing.mcpServers.zam = {
10428
- command: opts.zamPath,
10429
- args: ["mcp"]
10430
- };
10421
+ const expected = opts.zamPath.endsWith(".js") ? {
10422
+ command: process.execPath,
10423
+ args: [opts.zamPath, "mcp"]
10424
+ } : {
10425
+ command: opts.zamPath,
10426
+ args: ["mcp"]
10427
+ };
10428
+ const current = existing.mcpServers.zam;
10429
+ if (typeof current === "object" && current !== null && !Array.isArray(current)) {
10430
+ const c = current;
10431
+ if (c.command === expected.command && JSON.stringify(c.args) === JSON.stringify(expected.args)) {
10432
+ alreadyConfigured = true;
10433
+ }
10431
10434
  }
10435
+ existing.mcpServers.zam = expected;
10432
10436
  return JSON.stringify(existing, null, 2);
10433
10437
  };
10434
10438
  if (harnessId === "claude-code") {
@@ -10455,25 +10459,7 @@ function connectHarnessMcp(harnessId, opts) {
10455
10459
  } else if (harnessId === "antigravity") {
10456
10460
  targetPath = join16(opts.home, ".gemini", "config", "mcp_config.json");
10457
10461
  hint = "Shared config read by Antigravity CLI and IDE (2.0+); older IDE builds read ~/.gemini/antigravity/mcp_config.json instead. Refresh Installed MCP Servers; the first tool call may still require approval.";
10458
- let existing = {};
10459
- if (exists(targetPath)) {
10460
- existing = parseMcpJsonConfig(targetPath, read(targetPath));
10461
- }
10462
- if (!existing.mcpServers) {
10463
- existing.mcpServers = {};
10464
- }
10465
- if (opts.zamPath.endsWith(".js")) {
10466
- existing.mcpServers.zam = {
10467
- command: process.execPath,
10468
- args: [opts.zamPath, "mcp"]
10469
- };
10470
- } else {
10471
- existing.mcpServers.zam = {
10472
- command: opts.zamPath,
10473
- args: ["mcp"]
10474
- };
10475
- }
10476
- content = JSON.stringify(existing, null, 2);
10462
+ content = mergeMcpServersJson(targetPath);
10477
10463
  } else if (harnessId === "opencode") {
10478
10464
  targetPath = join16(opts.home, ".config", "opencode", "opencode.json");
10479
10465
  hint = "OpenCode will load the enabled 'zam' MCP server on next launch.";
@@ -10487,11 +10473,19 @@ function connectHarnessMcp(harnessId, opts) {
10487
10473
  }
10488
10474
  const servers = mcp ?? {};
10489
10475
  const cmd = opts.zamPath.endsWith(".js") ? [process.execPath, opts.zamPath, "mcp"] : [opts.zamPath, "mcp"];
10490
- servers.zam = {
10476
+ const expected = {
10491
10477
  type: "local",
10492
10478
  command: cmd,
10493
10479
  enabled: true
10494
10480
  };
10481
+ const current = servers.zam;
10482
+ if (typeof current === "object" && current !== null && !Array.isArray(current)) {
10483
+ const c = current;
10484
+ if (c.type === expected.type && c.enabled === expected.enabled && JSON.stringify(c.command) === JSON.stringify(expected.command)) {
10485
+ alreadyConfigured = true;
10486
+ }
10487
+ }
10488
+ servers.zam = expected;
10495
10489
  existing.mcp = servers;
10496
10490
  content = JSON.stringify(existing, null, 2);
10497
10491
  } else if (harnessId === "codex") {
@@ -10602,21 +10596,25 @@ ${zamExtension}
10602
10596
  if (!existing.mcpServers) {
10603
10597
  existing.mcpServers = {};
10604
10598
  }
10605
- if (opts.zamPath.endsWith(".js")) {
10606
- existing.mcpServers.zam = {
10607
- type: "local",
10608
- command: process.execPath,
10609
- args: [opts.zamPath, "mcp"],
10610
- tools: ["*"]
10611
- };
10612
- } else {
10613
- existing.mcpServers.zam = {
10614
- type: "local",
10615
- command: opts.zamPath,
10616
- args: ["mcp"],
10617
- tools: ["*"]
10618
- };
10599
+ const expected = opts.zamPath.endsWith(".js") ? {
10600
+ type: "local",
10601
+ command: process.execPath,
10602
+ args: [opts.zamPath, "mcp"],
10603
+ tools: ["*"]
10604
+ } : {
10605
+ type: "local",
10606
+ command: opts.zamPath,
10607
+ args: ["mcp"],
10608
+ tools: ["*"]
10609
+ };
10610
+ const current = existing.mcpServers.zam;
10611
+ if (typeof current === "object" && current !== null && !Array.isArray(current)) {
10612
+ const c = current;
10613
+ if (c.type === expected.type && c.command === expected.command && JSON.stringify(c.args) === JSON.stringify(expected.args) && JSON.stringify(c.tools) === JSON.stringify(expected.tools)) {
10614
+ alreadyConfigured = true;
10615
+ }
10619
10616
  }
10617
+ existing.mcpServers.zam = expected;
10620
10618
  content = JSON.stringify(existing, null, 2);
10621
10619
  }
10622
10620
  return {