negotium 0.22.4 → 0.22.5

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/main.js CHANGED
@@ -2019,7 +2019,7 @@ function loadClaudeAttachments() {
2019
2019
  }
2020
2020
  function encodeClaudeCwd(cwd) {
2021
2021
  const realCwd = cwd.startsWith("/tmp/") ? cwd.replace(/^\/tmp\//, "/private/tmp/") : cwd;
2022
- return `-${realCwd.replaceAll(/[^a-zA-Z0-9]/g, "-").replace(/^-/, "")}`;
2022
+ return realCwd.replaceAll(/[^a-zA-Z0-9]/g, "-");
2023
2023
  }
2024
2024
  function writeClaudeRollout(opts) {
2025
2025
  const sessionId = opts.sessionId ?? randomUUID();
@@ -5370,6 +5370,19 @@ function getNodeMcpServers() {
5370
5370
  function isReservedRuntimeMcpServerName(name) {
5371
5371
  return Object.hasOwn(MCP_CATALOG, name) || nodeMcpEntries.some((entry) => entry.key === name);
5372
5372
  }
5373
+ function hostMcpGrantRefusal(topic, names) {
5374
+ if (topic.kind === "manager")
5375
+ return null;
5376
+ if (topic.isSubagent)
5377
+ return "hostMcpServers is not allowed for subagent topics";
5378
+ const managerOnly = names.find((name) => MANAGER_ONLY_HOST_MCP_NAMES.has(name));
5379
+ return managerOnly ? `${managerOnly} is only allowed for manager topics` : null;
5380
+ }
5381
+ function withoutManagerOnlyHostMcpServers(hostMcpServers) {
5382
+ if (!hostMcpServers)
5383
+ return;
5384
+ return Object.fromEntries(Object.entries(hostMcpServers).filter(([name]) => !MANAGER_ONLY_HOST_MCP_NAMES.has(name)));
5385
+ }
5373
5386
  function mergeHostMcpServers(base, hostMcpServers) {
5374
5387
  if (!hostMcpServers)
5375
5388
  return base;
@@ -5630,7 +5643,7 @@ function getMcpServersForQuery(opts) {
5630
5643
  fileDeliveryTools: opts.fileDeliveryTools
5631
5644
  }), opts.hostMcpServers), opts.topicId);
5632
5645
  }
5633
- return hideProviderIntrospectionForOtium(getForumMcpServers({
5646
+ return hideProviderIntrospectionForOtium(mergeHostMcpServers(getForumMcpServers({
5634
5647
  userId: opts.userId || "local",
5635
5648
  actorUserId: opts.actorUserId,
5636
5649
  actorTopicScope: opts.actorTopicScope,
@@ -5657,7 +5670,7 @@ function getMcpServersForQuery(opts) {
5657
5670
  extra: opts.mcpExtra,
5658
5671
  silent: opts.silent,
5659
5672
  peerBridge: opts.peerBridge
5660
- }), opts.topicId);
5673
+ }), withoutManagerOnlyHostMcpServers(opts.hostMcpServers)), opts.topicId);
5661
5674
  }
5662
5675
  function hideProviderIntrospectionForOtium(servers, topicId) {
5663
5676
  if (!topicId || getTopic(topicId)?.surface !== "otium")
@@ -5667,7 +5680,7 @@ function hideProviderIntrospectionForOtium(servers, topicId) {
5667
5680
  delete filtered["token-stats"];
5668
5681
  return filtered;
5669
5682
  }
5670
- var _playwrightUnavailableNotifier, _playwrightUnavailableLastNotifiedAt, _PLAYWRIGHT_UNAVAILABLE_COOLDOWN_MS, _playwrightUnavailableThisTurn, cuaRsMcpPort, cuaRsMcpToken, MCP_CATALOG, nodeMcpEntries, resolvedNodeMcpPorts, allForumMcpServerNames, requiredForumMcpServers, REQUIRED_FORUM_MCP_SERVERS, optionalForumMcpServers, OPTIONAL_FORUM_MCP_SERVERS;
5683
+ var _playwrightUnavailableNotifier, _playwrightUnavailableLastNotifiedAt, _PLAYWRIGHT_UNAVAILABLE_COOLDOWN_MS, _playwrightUnavailableThisTurn, cuaRsMcpPort, cuaRsMcpToken, MCP_CATALOG, nodeMcpEntries, resolvedNodeMcpPorts, allForumMcpServerNames, requiredForumMcpServers, REQUIRED_FORUM_MCP_SERVERS, optionalForumMcpServers, OPTIONAL_FORUM_MCP_SERVERS, MANAGER_ONLY_HOST_MCP_NAMES;
5671
5684
  var init_mcp_config = __esm(async () => {
5672
5685
  init_explicit_agent_switch();
5673
5686
  init_canonical_bridge_config();
@@ -5924,6 +5937,7 @@ var init_mcp_config = __esm(async () => {
5924
5937
  optionalForumMcpServers = [];
5925
5938
  OPTIONAL_FORUM_MCP_SERVERS = optionalForumMcpServers;
5926
5939
  refreshForumCatalogViews();
5940
+ MANAGER_ONLY_HOST_MCP_NAMES = new Set(["topic-admin"]);
5927
5941
  });
5928
5942
 
5929
5943
  // ../../packages/core/src/agents/execution-host.ts
@@ -6540,7 +6554,7 @@ var exports_version = {};
6540
6554
  __export(exports_version, {
6541
6555
  NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
6542
6556
  });
6543
- var NEGOTIUM_VERSION = "0.22.4";
6557
+ var NEGOTIUM_VERSION = "0.22.5";
6544
6558
 
6545
6559
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
6546
6560
  import { spawn as spawn2 } from "child_process";
@@ -23128,8 +23142,10 @@ function resolveTurnToolCapabilities(topicId, params) {
23128
23142
  };
23129
23143
  }
23130
23144
  function resolveTurnHostMcpServers(topic, sessionType) {
23131
- const effectiveSessionType = sessionType ?? (topic.kind === "manager" ? "manager" : "forum");
23132
- if (topic.kind !== "manager" || effectiveSessionType !== "manager")
23145
+ if (topic.isSubagent)
23146
+ return;
23147
+ const ownScope = topic.kind === "manager" ? "manager" : "forum";
23148
+ if ((sessionType ?? ownScope) !== ownScope)
23133
23149
  return;
23134
23150
  return getTopicHostMcpGrant(topic.id) ?? undefined;
23135
23151
  }
@@ -26445,9 +26461,9 @@ function gatewayPayloadHash(params, requestId, actorUserId) {
26445
26461
  }
26446
26462
  function submitRuntimeGatewayTurn(params) {
26447
26463
  const hostMcpServers = parseHostMcpServers(params.hostMcpServers);
26448
- if (hostMcpServers !== undefined && params.topic.kind !== "manager") {
26449
- throw new TypeError("hostMcpServers is only allowed for manager topics");
26450
- }
26464
+ const grantRefusal = hostMcpServers === undefined ? null : hostMcpGrantRefusal(params.topic, Object.keys(hostMcpServers));
26465
+ if (grantRefusal)
26466
+ throw new TypeError(grantRefusal);
26451
26467
  const conflictingHostMcpName = Object.keys(hostMcpServers ?? {}).find(isReservedRuntimeMcpServerName);
26452
26468
  if (conflictingHostMcpName) {
26453
26469
  throw new TypeError(`host MCP server name conflicts with node catalog: ${conflictingHostMcpName}`);
@@ -29952,6 +29968,7 @@ __export(exports_node_host, {
29952
29968
  isReservedRuntimeMcpServerName: () => isReservedRuntimeMcpServerName,
29953
29969
  isParticipant: () => isParticipant,
29954
29970
  insertCommittedTopicCreateClaim: () => insertCommittedTopicCreateClaim,
29971
+ hostMcpGrantRefusal: () => hostMcpGrantRefusal,
29955
29972
  getVisibleTopics: () => getVisibleTopics,
29956
29973
  getTopicTombstone: () => getTopicTombstone,
29957
29974
  getTopicStats: () => getTopicStats,
@@ -39369,6 +39386,7 @@ function createNodeControlHandler(options) {
39369
39386
  capabilities: [
39370
39387
  "turn-submit-idempotent",
39371
39388
  "host-mcp-turn-injection",
39389
+ "host-mcp-forum-turn-injection",
39372
39390
  "turn-events-sse-resume",
39373
39391
  "canonical-topic-read",
39374
39392
  "canonical-message-read",
@@ -39636,9 +39654,9 @@ function createNodeControlHandler(options) {
39636
39654
  if (!topic.participants.some((participant) => participant.userId === userId)) {
39637
39655
  return jsonError(404, "Topic not found");
39638
39656
  }
39639
- if (hostMcpServers !== undefined && topic.kind !== "manager") {
39640
- return jsonError(400, "hostMcpServers is only allowed for manager topics");
39641
- }
39657
+ const grantRefusal = hostMcpServers === undefined ? null : hostMcpGrantRefusal(topic, Object.keys(hostMcpServers));
39658
+ if (grantRefusal)
39659
+ return jsonError(400, grantRefusal);
39642
39660
  if (attachments2.some((fileId) => !nodeFileStore.allows(fileId, { topicId, ownerUserId: userId }))) {
39643
39661
  return jsonError(404, "Attachment not found");
39644
39662
  }
@@ -59068,4 +59086,4 @@ switch (command) {
59068
59086
  }
59069
59087
  }
59070
59088
 
59071
- //# debugId=80556303BA5A6CCA64756E2164756E21
59089
+ //# debugId=B68892935362F4E964756E2164756E21