negotium 0.5.7 → 0.5.9

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.
@@ -2439,7 +2439,7 @@ var init_claude_registry = __esm(() => {
2439
2439
  });
2440
2440
 
2441
2441
  // ../../packages/core/src/version.ts
2442
- var NEGOTIUM_VERSION = "0.5.7";
2442
+ var NEGOTIUM_VERSION = "0.5.9";
2443
2443
 
2444
2444
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
2445
2445
  import { spawn as spawn2 } from "child_process";
@@ -6740,6 +6740,19 @@ function sharedToolsPartial() {
6740
6740
  }
6741
6741
  return _sharedToolsPartial;
6742
6742
  }
6743
+ function capabilityToolNotes(opts) {
6744
+ const notes = [
6745
+ ...opts.fileDeliveryTools ? [
6746
+ "- Sending files: use the file-delivery tool; never emit deprecated `[FILE:/absolute/path]` tags. Prefer ASCII names and richer formats (PDF over plain `.txt`)."
6747
+ ] : [],
6748
+ ...opts.visualTools ? [
6749
+ "- Visual output (HTML/CSS, dashboards, charts, tables): use the visual tool below instead of pasting large HTML into chat."
6750
+ ] : []
6751
+ ];
6752
+ return notes.length ? `
6753
+ ${notes.join(`
6754
+ `)}` : "";
6755
+ }
6743
6756
  function topicSystemPromptTemplate() {
6744
6757
  if (_topicSystemPromptTemplate === null) {
6745
6758
  _topicSystemPromptTemplate = loadSessionPrompt("topic-system.md", FALLBACK_TOPIC_SYSTEM_PROMPT_TEMPLATE);
@@ -6814,7 +6827,7 @@ function buildRuntimeToolSection(opts, extensions) {
6814
6827
  const decisionNamespace = "mcp__decision";
6815
6828
  const visualToolLine = agentKind === "codex" ? `To display charts, tables, or interactive HTML results to the user, call the \`show_html\` function in the \`${runtimeNamespace}\` namespace with { html: "<complete HTML string>", title?: "optional title" }.` : `To display charts, tables, or interactive HTML results to the user, call the MCP tool "${runtimeNamespace}__show_html" with { html: "<complete HTML string>", title?: "optional title" }.`;
6816
6829
  const mermaidToolLine = agentKind === "codex" ? `For diagrams that Mermaid supports, prefer the \`show_mermaid\` function in the \`${runtimeNamespace}\` namespace with { code: "<Mermaid DSL without markdown fences>", title?: "...", theme?: "neutral" }.` : `For diagrams that Mermaid supports, prefer the MCP tool "${runtimeNamespace}__show_mermaid" with { code: "<Mermaid DSL without markdown fences>", title?: "...", theme?: "neutral" }.`;
6817
- const mediaToolLine = agentKind === "codex" ? `To display an existing image or video in the visual panel, use \`show_image\` or \`show_video\` in the \`${runtimeNamespace}\` namespace with either { file_path: "...", title?: "..." } for a topic-workspace file or { file_id: "...", title?: "..." } for an uploaded file already attached in this topic.` : `To display an existing image or video in the visual panel, use MCP tool "${runtimeNamespace}__show_image" or "${runtimeNamespace}__show_video" with either { file_path: "...", title?: "..." } for a topic-workspace file or { file_id: "...", title?: "..." } for an uploaded file already attached in this topic.`;
6830
+ const mediaToolLine = agentKind === "codex" ? `To display an existing image in the visual panel, use \`show_image\` in the \`${runtimeNamespace}\` namespace with either { file_path: "...", title?: "..." } for a topic-workspace file or { file_id: "...", title?: "..." } for an uploaded file already attached in this topic.` : `To display an existing image in the visual panel, use MCP tool "${runtimeNamespace}__show_image" with either { file_path: "...", title?: "..." } for a topic-workspace file or { file_id: "...", title?: "..." } for an uploaded file already attached in this topic.`;
6818
6831
  const sendFileTool = agentKind === "codex" ? `\`send_file\` function in the \`${runtimeNamespace}\` namespace` : `MCP tool "${runtimeNamespace}__send_file"`;
6819
6832
  const askUserToolLine = agentKind === "codex" ? `When you need a blocking user choice, call the \`ask_user_question\` function in the \`${runtimeNamespace}\` namespace with { question: "...", choices: [{ label: "...", description?: "..." }] }.` : `When you need a blocking user choice, call the MCP tool "${runtimeNamespace}__ask_user_question" with { question: "...", choices: [{ label: "...", description?: "..." }] }.`;
6820
6833
  const scheduleSelfToolLine = agentKind === "codex" ? `For a one-shot delayed continuation within 24 hours, call the \`schedule_self\` function in the \`${runtimeNamespace}\` namespace with { delay_seconds: number, message: "self-contained future instruction" }. Only one pending self-schedule is allowed per topic; use \`get_self_schedule\`, \`update_self_schedule\`, or \`cancel_self_schedule\` in that namespace to manage it. Use cron-manager for recurring schedules.` : `For a one-shot delayed continuation within 24 hours, call the MCP tool "${runtimeNamespace}__schedule_self" with { delay_seconds: number, message: "self-contained future instruction" }. Only one pending self-schedule is allowed per topic; manage it with "${runtimeNamespace}__get_self_schedule", "${runtimeNamespace}__update_self_schedule", or "${runtimeNamespace}__cancel_self_schedule". Use cron-manager for recurring schedules.`;
@@ -6967,6 +6980,7 @@ function createPromptBuilders(host = {}) {
6967
6980
  const uploadsDir = `${opts.workspaceCwd}/attachments`;
6968
6981
  const templateVars = {
6969
6982
  SHARED_TOOLS: sharedToolsPartial(),
6983
+ CAPABILITY_TOOL_NOTES: capabilityToolNotes(opts),
6970
6984
  AI_LABEL: opts.aiLabel,
6971
6985
  TOPIC_TITLE: opts.topicTitle,
6972
6986
  WORKSPACE_CWD: opts.workspaceCwd,
@@ -15168,9 +15182,6 @@ function isVisualsShowMermaidTool(name) {
15168
15182
  function isVisualsShowImageTool(name) {
15169
15183
  return isRuntimeTool(name, "show_image") || isRuntimeTool(name, "show_png");
15170
15184
  }
15171
- function isVisualsShowVideoTool(name) {
15172
- return isRuntimeTool(name, "show_video");
15173
- }
15174
15185
  function normalizeToolUseId(value) {
15175
15186
  const normalized = value?.trim();
15176
15187
  return normalized ? normalized : undefined;
@@ -15549,9 +15560,9 @@ ${JSON.stringify(event.input ?? {})}`);
15549
15560
  broadcastStoredVisual(event, vizId, title, "mermaid");
15550
15561
  }
15551
15562
  }
15552
- } else if (isVisualsShowImageTool(event.name) || isVisualsShowVideoTool(event.name)) {
15563
+ } else if (isVisualsShowImageTool(event.name)) {
15553
15564
  const input = event.input;
15554
- const kind = isVisualsShowImageTool(event.name) ? "image" : "video";
15565
+ const kind = "image";
15555
15566
  const toolUseId = bindToolUseId(event.toolUseId);
15556
15567
  const label = formatToolUse(event.name, event.input);
15557
15568
  const failMediaVisual = (reason) => {
@@ -15571,14 +15582,10 @@ ${JSON.stringify(event.input ?? {})}`);
15571
15582
  failMediaVisual(media.error);
15572
15583
  break;
15573
15584
  }
15574
- if (kind === "image" && !media.mimeType.startsWith("image/")) {
15585
+ if (!media.mimeType.startsWith("image/")) {
15575
15586
  failMediaVisual(`expected image media, got ${media.mimeType}`);
15576
15587
  break;
15577
15588
  }
15578
- if (kind === "video" && !media.mimeType.startsWith("video/")) {
15579
- failMediaVisual(`expected video media, got ${media.mimeType}`);
15580
- break;
15581
- }
15582
15589
  try {
15583
15590
  const title = normalizeVisualTitle(input.title);
15584
15591
  if (peerBridge) {
@@ -15969,6 +15976,7 @@ __export(exports_turn_runner, {
15969
15976
  resolveWikiMirrorPath: () => resolveWikiMirrorPath,
15970
15977
  resolveWikiMemoryMirror: () => resolveWikiMemoryMirror,
15971
15978
  resolveVisualMediaInput: () => resolveVisualMediaInput,
15979
+ resolveTurnToolCapabilities: () => resolveTurnToolCapabilities,
15972
15980
  resolveTopicTurnSession: () => resolveTopicTurnSession,
15973
15981
  resolveTopicTurnExecution: () => resolveTopicTurnExecution,
15974
15982
  resolveSessionRetry: () => resolveSessionRetry,
@@ -15987,7 +15995,6 @@ __export(exports_turn_runner, {
15987
15995
  mergeSupersedingUserTurn: () => mergeSupersedingUserTurn,
15988
15996
  mentionsAi: () => mentionsAi,
15989
15997
  materializePromptAttachments: () => materializePromptAttachments,
15990
- isVisualsShowVideoTool: () => isVisualsShowVideoTool,
15991
15998
  isVisualsShowMermaidTool: () => isVisualsShowMermaidTool,
15992
15999
  isVisualsShowImageTool: () => isVisualsShowImageTool,
15993
16000
  isVisualsShowHtmlTool: () => isVisualsShowHtmlTool,
@@ -16308,6 +16315,13 @@ function resolveSessionRetry(opts) {
16308
16315
  logger.info({ topicId: opts.topicId, agent: opts.agent, hadSessionId: Boolean(opts.sessionId) }, "ai: session expired \u2014 retrying with fresh session");
16309
16316
  return { kind: "retry", sessionId: null };
16310
16317
  }
16318
+ function resolveTurnToolCapabilities(topicId, params) {
16319
+ const granted = params.visualTools === undefined || params.fileDeliveryTools === undefined ? getTopicToolCapabilities(topicId) : null;
16320
+ return {
16321
+ visualTools: params.visualTools ?? granted?.visualTools ?? false,
16322
+ fileDeliveryTools: params.fileDeliveryTools ?? granted?.fileDeliveryTools ?? false
16323
+ };
16324
+ }
16311
16325
  function mergeSupersedingUserTurn(running, incoming) {
16312
16326
  const userMessages = [
16313
16327
  ...running.userMessages ?? [legacyUserTurnEnvelope(running.prompt, running.attachments)],
@@ -16523,9 +16537,7 @@ function startAiTurn(params) {
16523
16537
  const cwd = params.cwd;
16524
16538
  const sessionName = params.sessionName ?? topic.title;
16525
16539
  const sessionType = params.sessionType;
16526
- const grantedForTopic = params.visualTools === undefined || params.fileDeliveryTools === undefined ? getTopicToolCapabilities(topicId) : null;
16527
- const visualTools = params.visualTools ?? grantedForTopic?.visualTools ?? false;
16528
- const fileDeliveryTools = params.fileDeliveryTools ?? grantedForTopic?.fileDeliveryTools ?? false;
16540
+ const { visualTools, fileDeliveryTools } = resolveTurnToolCapabilities(topicId, params);
16529
16541
  const onSessionId = params.onSessionId;
16530
16542
  const onSessionReset = params.onSessionReset;
16531
16543
  const bridgeSessionFromHistory = params.bridgeSessionFromHistory === true;
@@ -19107,27 +19119,7 @@ var showImageTool = {
19107
19119
  return textResult("Image displayed to the user.");
19108
19120
  }
19109
19121
  };
19110
- var showVideoTool = {
19111
- name: "show_video",
19112
- description: "Display a playable video in the user's visual side panel. Provide either file_path for a video in the topic workspace, or file_id for an uploaded file already attached in this topic.",
19113
- schema: {
19114
- file_path: z5.string().optional().describe("Absolute or workspace-relative path to a video file."),
19115
- file_id: z5.string().optional().describe("Full Otium uploaded file UUID for a video attached in this topic."),
19116
- title: z5.string().optional().describe("Optional title shown above the rendered card.")
19117
- },
19118
- async handler(input) {
19119
- if (!input?.file_path && !input?.file_id) {
19120
- return errorResult("file_path or file_id is required.");
19121
- }
19122
- return textResult("Video displayed to the user.");
19123
- }
19124
- };
19125
- var visualToolDefinitions = [
19126
- showHtmlTool,
19127
- showMermaidTool,
19128
- showImageTool,
19129
- showVideoTool
19130
- ];
19122
+ var visualToolDefinitions = [showHtmlTool, showMermaidTool, showImageTool];
19131
19123
 
19132
19124
  // ../../packages/core/src/agents/mcp-tools/visual-compat.ts
19133
19125
  var showPngTool = {
@@ -19140,8 +19132,7 @@ var otiumVisualToolDefinitions = [
19140
19132
  showHtmlTool,
19141
19133
  showMermaidTool,
19142
19134
  showImageTool,
19143
- showPngTool,
19144
- showVideoTool
19135
+ showPngTool
19145
19136
  ];
19146
19137
 
19147
19138
  // ../../packages/core/src/agents/public-helpers.ts
@@ -19157,7 +19148,6 @@ export {
19157
19148
  summarizeShellCommand,
19158
19149
  summarizeDisplayText,
19159
19150
  snapshotCodexChildren,
19160
- showVideoTool,
19161
19151
  showPngTool,
19162
19152
  showMermaidTool,
19163
19153
  showImageTool,
@@ -19199,4 +19189,4 @@ export {
19199
19189
  DEFAULT_SELF_CONFIG_PRODUCT
19200
19190
  };
19201
19191
 
19202
- //# debugId=0F25AE320982542264756E2164756E21
19192
+ //# debugId=5C27F540959207AC64756E2164756E21