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.
- package/dist/agent-helpers.js +31 -41
- package/dist/agent-helpers.js.map +10 -10
- package/dist/hosted-agent.js +2 -2
- package/dist/hosted-agent.js.map +2 -2
- package/dist/main.js +36 -40
- package/dist/main.js.map +10 -10
- package/dist/mcp-factories.js +29 -17
- package/dist/mcp-factories.js.map +7 -7
- package/dist/prompts.js +16 -2
- package/dist/prompts.js.map +3 -3
- package/dist/registry.js +2 -2
- package/dist/registry.js.map +2 -2
- package/dist/runtime/src/agents/mcp-tools/visual-compat.ts +1 -7
- package/dist/runtime/src/agents/mcp-tools/visuals.ts +1 -29
- package/dist/runtime/src/agents/public-helpers.ts +0 -1
- package/dist/runtime/src/prompts/builders.ts +28 -2
- package/dist/runtime/src/prompts/sessions/_shared-tools.md +1 -3
- package/dist/runtime/src/runtime/turn-event-stream.ts +3 -8
- package/dist/runtime/src/runtime/turn-runner.ts +30 -13
- package/dist/runtime/src/runtime/visuals.ts +0 -4
- package/dist/runtime/src/version.ts +1 -1
- package/dist/types/packages/core/src/agents/mcp-tools/visual-compat.d.ts +0 -9
- package/dist/types/packages/core/src/agents/mcp-tools/visuals.d.ts +0 -19
- package/dist/types/packages/core/src/agents/public-helpers.d.ts +1 -1
- package/dist/types/packages/core/src/runtime/turn-runner.d.ts +22 -0
- package/dist/types/packages/core/src/runtime/visuals.d.ts +0 -1
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1874,7 +1874,7 @@ var exports_version = {};
|
|
|
1874
1874
|
__export(exports_version, {
|
|
1875
1875
|
NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
|
|
1876
1876
|
});
|
|
1877
|
-
var NEGOTIUM_VERSION = "0.5.
|
|
1877
|
+
var NEGOTIUM_VERSION = "0.5.9";
|
|
1878
1878
|
|
|
1879
1879
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
1880
1880
|
import { spawn } from "child_process";
|
|
@@ -11857,6 +11857,19 @@ function sharedToolsPartial() {
|
|
|
11857
11857
|
}
|
|
11858
11858
|
return _sharedToolsPartial;
|
|
11859
11859
|
}
|
|
11860
|
+
function capabilityToolNotes(opts) {
|
|
11861
|
+
const notes = [
|
|
11862
|
+
...opts.fileDeliveryTools ? [
|
|
11863
|
+
"- Sending files: use the file-delivery tool; never emit deprecated `[FILE:/absolute/path]` tags. Prefer ASCII names and richer formats (PDF over plain `.txt`)."
|
|
11864
|
+
] : [],
|
|
11865
|
+
...opts.visualTools ? [
|
|
11866
|
+
"- Visual output (HTML/CSS, dashboards, charts, tables): use the visual tool below instead of pasting large HTML into chat."
|
|
11867
|
+
] : []
|
|
11868
|
+
];
|
|
11869
|
+
return notes.length ? `
|
|
11870
|
+
${notes.join(`
|
|
11871
|
+
`)}` : "";
|
|
11872
|
+
}
|
|
11860
11873
|
function topicSystemPromptTemplate() {
|
|
11861
11874
|
if (_topicSystemPromptTemplate === null) {
|
|
11862
11875
|
_topicSystemPromptTemplate = loadSessionPrompt("topic-system.md", FALLBACK_TOPIC_SYSTEM_PROMPT_TEMPLATE);
|
|
@@ -11931,7 +11944,7 @@ function buildRuntimeToolSection(opts, extensions) {
|
|
|
11931
11944
|
const decisionNamespace = "mcp__decision";
|
|
11932
11945
|
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" }.`;
|
|
11933
11946
|
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" }.`;
|
|
11934
|
-
const mediaToolLine = agentKind === "codex" ? `To display an existing image
|
|
11947
|
+
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.`;
|
|
11935
11948
|
const sendFileTool = agentKind === "codex" ? `\`send_file\` function in the \`${runtimeNamespace}\` namespace` : `MCP tool "${runtimeNamespace}__send_file"`;
|
|
11936
11949
|
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?: "..." }] }.`;
|
|
11937
11950
|
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.`;
|
|
@@ -12084,6 +12097,7 @@ function createPromptBuilders(host = {}) {
|
|
|
12084
12097
|
const uploadsDir = `${opts.workspaceCwd}/attachments`;
|
|
12085
12098
|
const templateVars = {
|
|
12086
12099
|
SHARED_TOOLS: sharedToolsPartial(),
|
|
12100
|
+
CAPABILITY_TOOL_NOTES: capabilityToolNotes(opts),
|
|
12087
12101
|
AI_LABEL: opts.aiLabel,
|
|
12088
12102
|
TOPIC_TITLE: opts.topicTitle,
|
|
12089
12103
|
WORKSPACE_CWD: opts.workspaceCwd,
|
|
@@ -17648,9 +17662,6 @@ function isVisualsShowMermaidTool(name) {
|
|
|
17648
17662
|
function isVisualsShowImageTool(name) {
|
|
17649
17663
|
return isRuntimeTool(name, "show_image") || isRuntimeTool(name, "show_png");
|
|
17650
17664
|
}
|
|
17651
|
-
function isVisualsShowVideoTool(name) {
|
|
17652
|
-
return isRuntimeTool(name, "show_video");
|
|
17653
|
-
}
|
|
17654
17665
|
function normalizeToolUseId(value) {
|
|
17655
17666
|
const normalized = value?.trim();
|
|
17656
17667
|
return normalized ? normalized : undefined;
|
|
@@ -18029,9 +18040,9 @@ ${JSON.stringify(event.input ?? {})}`);
|
|
|
18029
18040
|
broadcastStoredVisual(event, vizId, title, "mermaid");
|
|
18030
18041
|
}
|
|
18031
18042
|
}
|
|
18032
|
-
} else if (isVisualsShowImageTool(event.name)
|
|
18043
|
+
} else if (isVisualsShowImageTool(event.name)) {
|
|
18033
18044
|
const input = event.input;
|
|
18034
|
-
const kind =
|
|
18045
|
+
const kind = "image";
|
|
18035
18046
|
const toolUseId = bindToolUseId(event.toolUseId);
|
|
18036
18047
|
const label = formatToolUse(event.name, event.input);
|
|
18037
18048
|
const failMediaVisual = (reason) => {
|
|
@@ -18051,14 +18062,10 @@ ${JSON.stringify(event.input ?? {})}`);
|
|
|
18051
18062
|
failMediaVisual(media.error);
|
|
18052
18063
|
break;
|
|
18053
18064
|
}
|
|
18054
|
-
if (
|
|
18065
|
+
if (!media.mimeType.startsWith("image/")) {
|
|
18055
18066
|
failMediaVisual(`expected image media, got ${media.mimeType}`);
|
|
18056
18067
|
break;
|
|
18057
18068
|
}
|
|
18058
|
-
if (kind === "video" && !media.mimeType.startsWith("video/")) {
|
|
18059
|
-
failMediaVisual(`expected video media, got ${media.mimeType}`);
|
|
18060
|
-
break;
|
|
18061
|
-
}
|
|
18062
18069
|
try {
|
|
18063
18070
|
const title = normalizeVisualTitle(input.title);
|
|
18064
18071
|
if (peerBridge) {
|
|
@@ -18464,6 +18471,7 @@ __export(exports_turn_runner, {
|
|
|
18464
18471
|
resolveWikiMirrorPath: () => resolveWikiMirrorPath,
|
|
18465
18472
|
resolveWikiMemoryMirror: () => resolveWikiMemoryMirror,
|
|
18466
18473
|
resolveVisualMediaInput: () => resolveVisualMediaInput,
|
|
18474
|
+
resolveTurnToolCapabilities: () => resolveTurnToolCapabilities,
|
|
18467
18475
|
resolveTopicTurnSession: () => resolveTopicTurnSession,
|
|
18468
18476
|
resolveTopicTurnExecution: () => resolveTopicTurnExecution,
|
|
18469
18477
|
resolveSessionRetry: () => resolveSessionRetry,
|
|
@@ -18482,7 +18490,6 @@ __export(exports_turn_runner, {
|
|
|
18482
18490
|
mergeSupersedingUserTurn: () => mergeSupersedingUserTurn,
|
|
18483
18491
|
mentionsAi: () => mentionsAi,
|
|
18484
18492
|
materializePromptAttachments: () => materializePromptAttachments,
|
|
18485
|
-
isVisualsShowVideoTool: () => isVisualsShowVideoTool,
|
|
18486
18493
|
isVisualsShowMermaidTool: () => isVisualsShowMermaidTool,
|
|
18487
18494
|
isVisualsShowImageTool: () => isVisualsShowImageTool,
|
|
18488
18495
|
isVisualsShowHtmlTool: () => isVisualsShowHtmlTool,
|
|
@@ -18803,6 +18810,13 @@ function resolveSessionRetry(opts) {
|
|
|
18803
18810
|
logger.info({ topicId: opts.topicId, agent: opts.agent, hadSessionId: Boolean(opts.sessionId) }, "ai: session expired \u2014 retrying with fresh session");
|
|
18804
18811
|
return { kind: "retry", sessionId: null };
|
|
18805
18812
|
}
|
|
18813
|
+
function resolveTurnToolCapabilities(topicId, params) {
|
|
18814
|
+
const granted = params.visualTools === undefined || params.fileDeliveryTools === undefined ? getTopicToolCapabilities(topicId) : null;
|
|
18815
|
+
return {
|
|
18816
|
+
visualTools: params.visualTools ?? granted?.visualTools ?? false,
|
|
18817
|
+
fileDeliveryTools: params.fileDeliveryTools ?? granted?.fileDeliveryTools ?? false
|
|
18818
|
+
};
|
|
18819
|
+
}
|
|
18806
18820
|
function mergeSupersedingUserTurn(running, incoming) {
|
|
18807
18821
|
const userMessages = [
|
|
18808
18822
|
...running.userMessages ?? [legacyUserTurnEnvelope(running.prompt, running.attachments)],
|
|
@@ -19018,9 +19032,7 @@ function startAiTurn(params) {
|
|
|
19018
19032
|
const cwd = params.cwd;
|
|
19019
19033
|
const sessionName = params.sessionName ?? topic.title;
|
|
19020
19034
|
const sessionType = params.sessionType;
|
|
19021
|
-
const
|
|
19022
|
-
const visualTools = params.visualTools ?? grantedForTopic?.visualTools ?? false;
|
|
19023
|
-
const fileDeliveryTools = params.fileDeliveryTools ?? grantedForTopic?.fileDeliveryTools ?? false;
|
|
19035
|
+
const { visualTools, fileDeliveryTools } = resolveTurnToolCapabilities(topicId, params);
|
|
19024
19036
|
const onSessionId = params.onSessionId;
|
|
19025
19037
|
const onSessionReset = params.onSessionReset;
|
|
19026
19038
|
const bridgeSessionFromHistory = params.bridgeSessionFromHistory === true;
|
|
@@ -20626,7 +20638,7 @@ var init_spawn_subagent = __esm(async () => {
|
|
|
20626
20638
|
|
|
20627
20639
|
// ../../packages/core/src/agents/mcp-tools/visuals.ts
|
|
20628
20640
|
import { z as z4 } from "zod";
|
|
20629
|
-
var showHtmlTool, showMermaidTool, showImageTool,
|
|
20641
|
+
var showHtmlTool, showMermaidTool, showImageTool, visualToolDefinitions;
|
|
20630
20642
|
var init_visuals2 = __esm(() => {
|
|
20631
20643
|
init_common();
|
|
20632
20644
|
showHtmlTool = {
|
|
@@ -20668,27 +20680,7 @@ var init_visuals2 = __esm(() => {
|
|
|
20668
20680
|
return textResult("Image displayed to the user.");
|
|
20669
20681
|
}
|
|
20670
20682
|
};
|
|
20671
|
-
|
|
20672
|
-
name: "show_video",
|
|
20673
|
-
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.",
|
|
20674
|
-
schema: {
|
|
20675
|
-
file_path: z4.string().optional().describe("Absolute or workspace-relative path to a video file."),
|
|
20676
|
-
file_id: z4.string().optional().describe("Full Otium uploaded file UUID for a video attached in this topic."),
|
|
20677
|
-
title: z4.string().optional().describe("Optional title shown above the rendered card.")
|
|
20678
|
-
},
|
|
20679
|
-
async handler(input) {
|
|
20680
|
-
if (!input?.file_path && !input?.file_id) {
|
|
20681
|
-
return errorResult("file_path or file_id is required.");
|
|
20682
|
-
}
|
|
20683
|
-
return textResult("Video displayed to the user.");
|
|
20684
|
-
}
|
|
20685
|
-
};
|
|
20686
|
-
visualToolDefinitions = [
|
|
20687
|
-
showHtmlTool,
|
|
20688
|
-
showMermaidTool,
|
|
20689
|
-
showImageTool,
|
|
20690
|
-
showVideoTool
|
|
20691
|
-
];
|
|
20683
|
+
visualToolDefinitions = [showHtmlTool, showMermaidTool, showImageTool];
|
|
20692
20684
|
});
|
|
20693
20685
|
|
|
20694
20686
|
// ../../packages/core/src/application/execute-external-user-turn.ts
|
|
@@ -28795,9 +28787,13 @@ function buildNegotiumMcpServer(ctx) {
|
|
|
28795
28787
|
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;
|
|
28796
28788
|
server.tool(def.name, def.description, def.schema, handler);
|
|
28797
28789
|
}
|
|
28798
|
-
|
|
28790
|
+
const publishTools = createPublishHtmlToolDefinitions({ cwd: ctx.cwd });
|
|
28791
|
+
for (const def of publishTools) {
|
|
28799
28792
|
server.tool(def.name, def.description, def.schema, def.handler);
|
|
28800
28793
|
}
|
|
28794
|
+
if (publishTools.length === 0) {
|
|
28795
|
+
logger.warn({ topicId: ctx.topicId }, "negotium MCP: visual tools granted but publish_html omitted; set NEGOTIUM_SNIPPETS_API_URL on this node to match a hub that has one");
|
|
28796
|
+
}
|
|
28801
28797
|
}
|
|
28802
28798
|
const selfConfigCtx = {
|
|
28803
28799
|
topicId: ctx.topicId,
|
|
@@ -47810,4 +47806,4 @@ switch (command) {
|
|
|
47810
47806
|
}
|
|
47811
47807
|
}
|
|
47812
47808
|
|
|
47813
|
-
//# debugId=
|
|
47809
|
+
//# debugId=327D87640EDE29BD64756E2164756E21
|