negotium 0.5.8 → 0.5.11
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 +30 -69
- package/dist/agent-helpers.js.map +10 -10
- package/dist/hosted-agent.js +7 -30
- package/dist/hosted-agent.js.map +4 -4
- package/dist/main.js +30 -67
- package/dist/main.js.map +9 -9
- package/dist/mcp-factories.js +28 -45
- package/dist/mcp-factories.js.map +7 -7
- package/dist/prompts.js +2 -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/maestro-provider.ts +8 -35
- 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 +2 -2
- package/dist/runtime/src/runtime/turn-event-stream.ts +22 -11
- package/dist/runtime/src/runtime/visuals.ts +0 -4
- package/dist/runtime/src/version.ts +1 -1
- package/dist/types/packages/core/src/agents/maestro-provider.d.ts +3 -4
- 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/visuals.d.ts +0 -1
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/package.json +2 -2
package/dist/agent-helpers.js
CHANGED
|
@@ -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.
|
|
2442
|
+
var NEGOTIUM_VERSION = "0.5.11";
|
|
2443
2443
|
|
|
2444
2444
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
2445
2445
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -6023,14 +6023,8 @@ function buildVaultHook(userId) {
|
|
|
6023
6023
|
function buildMaestroToolHooks(userId) {
|
|
6024
6024
|
return [buildVaultHook(userId), buildProviderOwnedToolBlockHook()];
|
|
6025
6025
|
}
|
|
6026
|
-
function providerOwnedToolRedirect(
|
|
6027
|
-
|
|
6028
|
-
return "Use the runtime ask_user_question MCP tool instead.";
|
|
6029
|
-
}
|
|
6030
|
-
if (toolName === PROVIDER_SUBAGENT_TOOL) {
|
|
6031
|
-
return "Use the runtime spawn_subagent MCP tool instead.";
|
|
6032
|
-
}
|
|
6033
|
-
return "Use the shared task MCP tools instead " + "(mcp__task__task_create / task_update / task_list / task_get / task_delete).";
|
|
6026
|
+
function providerOwnedToolRedirect() {
|
|
6027
|
+
return "Use the runtime ask_user_question MCP tool instead.";
|
|
6034
6028
|
}
|
|
6035
6029
|
function resolveMaestroApiKeyOverrides(userId) {
|
|
6036
6030
|
if (!userId)
|
|
@@ -6052,7 +6046,7 @@ function buildProviderOwnedToolBlockHook() {
|
|
|
6052
6046
|
return { decision: "allow" };
|
|
6053
6047
|
return {
|
|
6054
6048
|
decision: "block",
|
|
6055
|
-
error: `${toolName} is disabled in this environment. ${providerOwnedToolRedirect(
|
|
6049
|
+
error: `${toolName} is disabled in this environment. ${providerOwnedToolRedirect()}`
|
|
6056
6050
|
};
|
|
6057
6051
|
}
|
|
6058
6052
|
};
|
|
@@ -6088,31 +6082,15 @@ function maestroProvider(opts) {
|
|
|
6088
6082
|
};
|
|
6089
6083
|
return sdkMaestroProvider(sdkOpts);
|
|
6090
6084
|
}
|
|
6091
|
-
var MAESTRO_DEFAULT_MAX_TOKENS = 32768, PROVIDER_ASK_USER_TOOL = "AskUserQuestion",
|
|
6085
|
+
var MAESTRO_DEFAULT_MAX_TOKENS = 32768, PROVIDER_ASK_USER_TOOL = "AskUserQuestion", MAESTRO_PROVIDER_OWNED_TOOL_SET, DEFAULT_MAESTRO_DISALLOWED_TOOLS, MAESTRO_ALL_BUILTIN_TOOLS, MAESTRO_TOOL_OUTPUT_DIR;
|
|
6092
6086
|
var init_maestro_provider = __esm(async () => {
|
|
6093
6087
|
init_maestro_bootstrap_env();
|
|
6094
6088
|
await init_execution_host();
|
|
6095
6089
|
init_vault_tool_policy();
|
|
6096
6090
|
init_config();
|
|
6097
6091
|
await init_vault();
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
"TaskUpdate",
|
|
6101
|
-
"TaskList",
|
|
6102
|
-
"TaskGet",
|
|
6103
|
-
"TaskOutput",
|
|
6104
|
-
"TaskStop"
|
|
6105
|
-
];
|
|
6106
|
-
MAESTRO_PROVIDER_OWNED_TOOL_SET = new Set([
|
|
6107
|
-
PROVIDER_ASK_USER_TOOL,
|
|
6108
|
-
PROVIDER_SUBAGENT_TOOL,
|
|
6109
|
-
...MAESTRO_NATIVE_TASK_TOOLS
|
|
6110
|
-
]);
|
|
6111
|
-
DEFAULT_MAESTRO_DISALLOWED_TOOLS = [
|
|
6112
|
-
PROVIDER_ASK_USER_TOOL,
|
|
6113
|
-
PROVIDER_SUBAGENT_TOOL,
|
|
6114
|
-
...MAESTRO_NATIVE_TASK_TOOLS
|
|
6115
|
-
];
|
|
6092
|
+
MAESTRO_PROVIDER_OWNED_TOOL_SET = new Set([PROVIDER_ASK_USER_TOOL]);
|
|
6093
|
+
DEFAULT_MAESTRO_DISALLOWED_TOOLS = [PROVIDER_ASK_USER_TOOL];
|
|
6116
6094
|
MAESTRO_ALL_BUILTIN_TOOLS = [
|
|
6117
6095
|
"Bash",
|
|
6118
6096
|
"Read",
|
|
@@ -6827,7 +6805,7 @@ function buildRuntimeToolSection(opts, extensions) {
|
|
|
6827
6805
|
const decisionNamespace = "mcp__decision";
|
|
6828
6806
|
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" }.`;
|
|
6829
6807
|
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" }.`;
|
|
6830
|
-
const mediaToolLine = agentKind === "codex" ? `To display an existing image
|
|
6808
|
+
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.`;
|
|
6831
6809
|
const sendFileTool = agentKind === "codex" ? `\`send_file\` function in the \`${runtimeNamespace}\` namespace` : `MCP tool "${runtimeNamespace}__send_file"`;
|
|
6832
6810
|
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?: "..." }] }.`;
|
|
6833
6811
|
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.`;
|
|
@@ -15182,9 +15160,6 @@ function isVisualsShowMermaidTool(name) {
|
|
|
15182
15160
|
function isVisualsShowImageTool(name) {
|
|
15183
15161
|
return isRuntimeTool(name, "show_image") || isRuntimeTool(name, "show_png");
|
|
15184
15162
|
}
|
|
15185
|
-
function isVisualsShowVideoTool(name) {
|
|
15186
|
-
return isRuntimeTool(name, "show_video");
|
|
15187
|
-
}
|
|
15188
15163
|
function normalizeToolUseId(value) {
|
|
15189
15164
|
const normalized = value?.trim();
|
|
15190
15165
|
return normalized ? normalized : undefined;
|
|
@@ -15324,6 +15299,7 @@ async function runTurnEventStream(topicId, topicTitle, queryId, events, control,
|
|
|
15324
15299
|
const peerBridge = execution?.peerBridge ?? control.injectParams?.peerBridge;
|
|
15325
15300
|
let errorOccurred = false;
|
|
15326
15301
|
let terminalEmitted = false;
|
|
15302
|
+
let lastEventType = null;
|
|
15327
15303
|
let pendingSawDelta = false;
|
|
15328
15304
|
let accumulatedText = "";
|
|
15329
15305
|
let pendingText = "";
|
|
@@ -15457,6 +15433,7 @@ async function runTurnEventStream(topicId, topicTitle, queryId, events, control,
|
|
|
15457
15433
|
for await (const event of events) {
|
|
15458
15434
|
if (abortController.signal.aborted)
|
|
15459
15435
|
break;
|
|
15436
|
+
lastEventType = event.type;
|
|
15460
15437
|
if (!control.providerTurnContentObserved && (event.type === "text_delta" || event.type === "text" || event.type === "reasoning" || event.type === "tool_use" || event.type === "tool_result" || event.type === "file" || event.type === "result")) {
|
|
15461
15438
|
control.providerTurnContentObserved = true;
|
|
15462
15439
|
if (control.sessionId) {
|
|
@@ -15563,9 +15540,9 @@ ${JSON.stringify(event.input ?? {})}`);
|
|
|
15563
15540
|
broadcastStoredVisual(event, vizId, title, "mermaid");
|
|
15564
15541
|
}
|
|
15565
15542
|
}
|
|
15566
|
-
} else if (isVisualsShowImageTool(event.name)
|
|
15543
|
+
} else if (isVisualsShowImageTool(event.name)) {
|
|
15567
15544
|
const input = event.input;
|
|
15568
|
-
const kind =
|
|
15545
|
+
const kind = "image";
|
|
15569
15546
|
const toolUseId = bindToolUseId(event.toolUseId);
|
|
15570
15547
|
const label = formatToolUse(event.name, event.input);
|
|
15571
15548
|
const failMediaVisual = (reason) => {
|
|
@@ -15585,14 +15562,10 @@ ${JSON.stringify(event.input ?? {})}`);
|
|
|
15585
15562
|
failMediaVisual(media.error);
|
|
15586
15563
|
break;
|
|
15587
15564
|
}
|
|
15588
|
-
if (
|
|
15565
|
+
if (!media.mimeType.startsWith("image/")) {
|
|
15589
15566
|
failMediaVisual(`expected image media, got ${media.mimeType}`);
|
|
15590
15567
|
break;
|
|
15591
15568
|
}
|
|
15592
|
-
if (kind === "video" && !media.mimeType.startsWith("video/")) {
|
|
15593
|
-
failMediaVisual(`expected video media, got ${media.mimeType}`);
|
|
15594
|
-
break;
|
|
15595
|
-
}
|
|
15596
15569
|
try {
|
|
15597
15570
|
const title = normalizeVisualTitle(input.title);
|
|
15598
15571
|
if (peerBridge) {
|
|
@@ -15849,12 +15822,23 @@ ${JSON.stringify(event.input ?? {})}`);
|
|
|
15849
15822
|
deliverAskError(queryId, topicTitle, msg);
|
|
15850
15823
|
}
|
|
15851
15824
|
} finally {
|
|
15825
|
+
if (!terminalEmitted && !abortController.signal.aborted) {
|
|
15826
|
+
const error = "Provider stream ended without a terminal event";
|
|
15827
|
+
outcome = { kind: "provider-error", error };
|
|
15828
|
+
logger.warn({
|
|
15829
|
+
topicId,
|
|
15830
|
+
queryId,
|
|
15831
|
+
agentType,
|
|
15832
|
+
model,
|
|
15833
|
+
silent,
|
|
15834
|
+
lastEventType,
|
|
15835
|
+
hadAssistantOutput: visibleMessageIds.length > 0 || pendingText.length > 0,
|
|
15836
|
+
hadToolActivity: syntheticToolCounter > 0 || providerToolIds.size > 0
|
|
15837
|
+
}, "ai: provider stream ended without result, error, or abort");
|
|
15838
|
+
}
|
|
15852
15839
|
const discardIncompleteSegments = outcome.kind === "session-expired" || outcome.kind === "provider-error" || !terminalEmitted && !abortController.signal.aborted;
|
|
15853
15840
|
if (discardIncompleteSegments)
|
|
15854
15841
|
discardVisibleAssistantMessages();
|
|
15855
|
-
if (!terminalEmitted && !silent) {
|
|
15856
|
-
hub.broadcastDone(topicId, queryId, undefined, { agent: agentType, model });
|
|
15857
|
-
}
|
|
15858
15842
|
const stillCurrent = getRoomQuery(roomId)?.queryId === queryId;
|
|
15859
15843
|
clearRoomQuery(roomId, queryId);
|
|
15860
15844
|
cancelPendingAskUserQuestions(topicId, queryId);
|
|
@@ -16002,7 +15986,6 @@ __export(exports_turn_runner, {
|
|
|
16002
15986
|
mergeSupersedingUserTurn: () => mergeSupersedingUserTurn,
|
|
16003
15987
|
mentionsAi: () => mentionsAi,
|
|
16004
15988
|
materializePromptAttachments: () => materializePromptAttachments,
|
|
16005
|
-
isVisualsShowVideoTool: () => isVisualsShowVideoTool,
|
|
16006
15989
|
isVisualsShowMermaidTool: () => isVisualsShowMermaidTool,
|
|
16007
15990
|
isVisualsShowImageTool: () => isVisualsShowImageTool,
|
|
16008
15991
|
isVisualsShowHtmlTool: () => isVisualsShowHtmlTool,
|
|
@@ -19127,27 +19110,7 @@ var showImageTool = {
|
|
|
19127
19110
|
return textResult("Image displayed to the user.");
|
|
19128
19111
|
}
|
|
19129
19112
|
};
|
|
19130
|
-
var
|
|
19131
|
-
name: "show_video",
|
|
19132
|
-
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.",
|
|
19133
|
-
schema: {
|
|
19134
|
-
file_path: z5.string().optional().describe("Absolute or workspace-relative path to a video file."),
|
|
19135
|
-
file_id: z5.string().optional().describe("Full Otium uploaded file UUID for a video attached in this topic."),
|
|
19136
|
-
title: z5.string().optional().describe("Optional title shown above the rendered card.")
|
|
19137
|
-
},
|
|
19138
|
-
async handler(input) {
|
|
19139
|
-
if (!input?.file_path && !input?.file_id) {
|
|
19140
|
-
return errorResult("file_path or file_id is required.");
|
|
19141
|
-
}
|
|
19142
|
-
return textResult("Video displayed to the user.");
|
|
19143
|
-
}
|
|
19144
|
-
};
|
|
19145
|
-
var visualToolDefinitions = [
|
|
19146
|
-
showHtmlTool,
|
|
19147
|
-
showMermaidTool,
|
|
19148
|
-
showImageTool,
|
|
19149
|
-
showVideoTool
|
|
19150
|
-
];
|
|
19113
|
+
var visualToolDefinitions = [showHtmlTool, showMermaidTool, showImageTool];
|
|
19151
19114
|
|
|
19152
19115
|
// ../../packages/core/src/agents/mcp-tools/visual-compat.ts
|
|
19153
19116
|
var showPngTool = {
|
|
@@ -19160,8 +19123,7 @@ var otiumVisualToolDefinitions = [
|
|
|
19160
19123
|
showHtmlTool,
|
|
19161
19124
|
showMermaidTool,
|
|
19162
19125
|
showImageTool,
|
|
19163
|
-
showPngTool
|
|
19164
|
-
showVideoTool
|
|
19126
|
+
showPngTool
|
|
19165
19127
|
];
|
|
19166
19128
|
|
|
19167
19129
|
// ../../packages/core/src/agents/public-helpers.ts
|
|
@@ -19177,7 +19139,6 @@ export {
|
|
|
19177
19139
|
summarizeShellCommand,
|
|
19178
19140
|
summarizeDisplayText,
|
|
19179
19141
|
snapshotCodexChildren,
|
|
19180
|
-
showVideoTool,
|
|
19181
19142
|
showPngTool,
|
|
19182
19143
|
showMermaidTool,
|
|
19183
19144
|
showImageTool,
|
|
@@ -19219,4 +19180,4 @@ export {
|
|
|
19219
19180
|
DEFAULT_SELF_CONFIG_PRODUCT
|
|
19220
19181
|
};
|
|
19221
19182
|
|
|
19222
|
-
//# debugId=
|
|
19183
|
+
//# debugId=45ECD1D1620CDA8E64756E2164756E21
|