negotium 0.22.7 → 0.22.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.
package/dist/main.js CHANGED
@@ -6559,7 +6559,7 @@ var exports_version = {};
6559
6559
  __export(exports_version, {
6560
6560
  NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
6561
6561
  });
6562
- var NEGOTIUM_VERSION = "0.22.7";
6562
+ var NEGOTIUM_VERSION = "0.22.8";
6563
6563
 
6564
6564
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
6565
6565
  import { spawn as spawn2 } from "child_process";
@@ -21485,7 +21485,7 @@ function buildVideoHtml(mimeType) {
21485
21485
  <body><video controls playsinline preload="metadata" src="${VISUAL_MEDIA_URL_PLACEHOLDER}" data-mime="${escapeHtml2(mimeType)}"></video></body>
21486
21486
  </html>`;
21487
21487
  }
21488
- function resolveVisualMediaInput(topicId, input) {
21488
+ function locateVisualMediaInput(topicId, input) {
21489
21489
  if (typeof input.file_id === "string" && input.file_id.trim()) {
21490
21490
  const fileId = input.file_id.trim().toLowerCase();
21491
21491
  if (!isUploadFileId(fileId))
@@ -21493,15 +21493,11 @@ function resolveVisualMediaInput(topicId, input) {
21493
21493
  if (!topicAllowsVisualFileId(topicId, fileId)) {
21494
21494
  return { error: "file_id is not attached to this topic" };
21495
21495
  }
21496
- const attachment2 = resolveAttachmentByFileId(fileId);
21497
- const filePath2 = resolveUploadedFilePathByFileId(fileId);
21498
- if (!attachment2 || !filePath2)
21496
+ const attachment = resolveAttachmentByFileId(fileId);
21497
+ const filePath = resolveUploadedFilePathByFileId(fileId);
21498
+ if (!attachment || !filePath)
21499
21499
  return { error: `uploaded file not found: ${fileId}` };
21500
- return {
21501
- fileId: attachment2.id,
21502
- mimeType: attachment2.mimeType,
21503
- source: `file_id:${attachment2.id}`
21504
- };
21500
+ return { kind: "upload", fileId: attachment.id, mimeType: attachment.mimeType };
21505
21501
  }
21506
21502
  if (typeof input.file_path !== "string" || !input.file_path.trim()) {
21507
21503
  return { error: "file_path or file_id is required" };
@@ -21509,18 +21505,38 @@ function resolveVisualMediaInput(topicId, input) {
21509
21505
  const rawPath = input.file_path.trim();
21510
21506
  const cwd = workspaceCwdFor(topicId);
21511
21507
  const candidate = isAbsolute5(rawPath) ? rawPath : resolve16(cwd, rawPath);
21512
- if (!isPathInside(cwd, candidate)) {
21513
- return { error: "file_path must be inside the topic workspace" };
21514
- }
21515
21508
  let realCandidate;
21516
21509
  try {
21517
21510
  realCandidate = realpathSync5(candidate);
21518
21511
  } catch {
21519
21512
  return { error: `file not found: ${rawPath}` };
21520
21513
  }
21514
+ if (!isPathInside(cwd, realCandidate)) {
21515
+ return {
21516
+ error: `file_path must be inside the topic workspace (${cwd}); copy the file into it and pass the copy`
21517
+ };
21518
+ }
21521
21519
  if (isSensitivePath(realCandidate)) {
21522
21520
  return { error: "file_path matches the sensitive-file blacklist" };
21523
21521
  }
21522
+ return { kind: "file", path: realCandidate, rawPath };
21523
+ }
21524
+ function visualMediaInputError(topicId, input) {
21525
+ const located = locateVisualMediaInput(topicId, input);
21526
+ return "error" in located ? located.error : null;
21527
+ }
21528
+ function resolveVisualMediaInput(topicId, input) {
21529
+ const located = locateVisualMediaInput(topicId, input);
21530
+ if ("error" in located)
21531
+ return located;
21532
+ if (located.kind === "upload") {
21533
+ return {
21534
+ fileId: located.fileId,
21535
+ mimeType: located.mimeType,
21536
+ source: `file_id:${located.fileId}`
21537
+ };
21538
+ }
21539
+ const { path: realCandidate, rawPath } = located;
21524
21540
  const attachment = storeLocalFileAsUpload(realCandidate, { topicId });
21525
21541
  if (!attachment)
21526
21542
  return { error: `failed to store media file: ${rawPath}` };
@@ -22791,6 +22807,7 @@ __export(exports_turn_runner, {
22791
22807
  workspaceCwdFor: () => workspaceCwdFor,
22792
22808
  withDefaultPlaywright: () => withDefaultPlaywright,
22793
22809
  wasLocallyRequeuedAfterUserPreemption: () => wasLocallyRequeuedAfterUserPreemption,
22810
+ visualMediaInputError: () => visualMediaInputError,
22794
22811
  userConversationPromptsToRecord: () => userConversationPromptsToRecord,
22795
22812
  upsertTaskPanelMessage: () => upsertTaskPanelMessage,
22796
22813
  tryReconstructTopicRollout: () => tryReconstructTopicRollout,
@@ -30444,6 +30461,7 @@ var init_thread_read = __esm(async () => {
30444
30461
  var exports_mcp_runtime_host = {};
30445
30462
  __export(exports_mcp_runtime_host, {
30446
30463
  visualToolDefinitions: () => visualToolDefinitions,
30464
+ visualMediaInputError: () => visualMediaInputError,
30447
30465
  textResult: () => textResult,
30448
30466
  storeLocalFileAsUpload: () => storeLocalFileAsUpload,
30449
30467
  showPngTool: () => showPngTool,
@@ -30457,6 +30475,7 @@ __export(exports_mcp_runtime_host, {
30457
30475
  prepareDeliveryAck: () => prepareDeliveryAck,
30458
30476
  logger: () => logger,
30459
30477
  listTopicThreadRoots: () => listTopicThreadRoots,
30478
+ isVisualsShowImageTool: () => isVisualsShowImageTool,
30460
30479
  isSensitivePath: () => isSensitivePath,
30461
30480
  isParticipant: () => isParticipant,
30462
30481
  isInsideDir: () => isInsideDir,
@@ -30533,6 +30552,7 @@ var init_mcp_runtime_host = __esm(async () => {
30533
30552
  init_actor_topic_reach(),
30534
30553
  init_delivery_ack(),
30535
30554
  init_thread_read(),
30555
+ init_visuals(),
30536
30556
  init_api_messages(),
30537
30557
  init_api_topic_config(),
30538
30558
  init_api_topics(),
@@ -35524,7 +35544,12 @@ function buildNegotiumMcpServer(ctx) {
35524
35544
  const server = new McpServer8({ name: RUNTIME_MCP_KEY, version: "1.0.0" });
35525
35545
  if (ctx.visualTools === true) {
35526
35546
  for (const def of [...visualToolDefinitions, showPngTool]) {
35527
- const handler = ctx.peerBridge && (def.name === "show_html" || def.name === "show_mermaid") ? async () => textResult("Visual queued for ordered display on the canonical hub.") : def.handler;
35547
+ const handler = ctx.peerBridge && (def.name === "show_html" || def.name === "show_mermaid") ? async () => textResult("Visual queued for ordered display on the canonical hub.") : isVisualsShowImageTool(def.name) ? async (input) => {
35548
+ const problem = visualMediaInputError(ctx.topicId, input ?? {});
35549
+ if (problem)
35550
+ return errorResult(`Error: ${problem}`);
35551
+ return def.handler(input);
35552
+ } : def.handler;
35528
35553
  server.tool(def.name, def.description, def.schema, handler);
35529
35554
  }
35530
35555
  const publishTools = createPublishHtmlToolDefinitions({ cwd: ctx.cwd });
@@ -59153,4 +59178,4 @@ switch (command) {
59153
59178
  }
59154
59179
  }
59155
59180
 
59156
- //# debugId=CF8B8D72488623B764756E2164756E21
59181
+ //# debugId=CF7D25563A652B9264756E2164756E21