negotium 0.5.9 → 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.
@@ -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.9";
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(toolName) {
6027
- if (toolName === PROVIDER_ASK_USER_TOOL) {
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(toolName)}`
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", PROVIDER_SUBAGENT_TOOL = "Agent", MAESTRO_NATIVE_TASK_TOOLS, MAESTRO_PROVIDER_OWNED_TOOL_SET, DEFAULT_MAESTRO_DISALLOWED_TOOLS, MAESTRO_ALL_BUILTIN_TOOLS, MAESTRO_TOOL_OUTPUT_DIR;
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
- MAESTRO_NATIVE_TASK_TOOLS = [
6099
- "TaskCreate",
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",
@@ -15321,6 +15299,7 @@ async function runTurnEventStream(topicId, topicTitle, queryId, events, control,
15321
15299
  const peerBridge = execution?.peerBridge ?? control.injectParams?.peerBridge;
15322
15300
  let errorOccurred = false;
15323
15301
  let terminalEmitted = false;
15302
+ let lastEventType = null;
15324
15303
  let pendingSawDelta = false;
15325
15304
  let accumulatedText = "";
15326
15305
  let pendingText = "";
@@ -15454,6 +15433,7 @@ async function runTurnEventStream(topicId, topicTitle, queryId, events, control,
15454
15433
  for await (const event of events) {
15455
15434
  if (abortController.signal.aborted)
15456
15435
  break;
15436
+ lastEventType = event.type;
15457
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")) {
15458
15438
  control.providerTurnContentObserved = true;
15459
15439
  if (control.sessionId) {
@@ -15842,12 +15822,23 @@ ${JSON.stringify(event.input ?? {})}`);
15842
15822
  deliverAskError(queryId, topicTitle, msg);
15843
15823
  }
15844
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
+ }
15845
15839
  const discardIncompleteSegments = outcome.kind === "session-expired" || outcome.kind === "provider-error" || !terminalEmitted && !abortController.signal.aborted;
15846
15840
  if (discardIncompleteSegments)
15847
15841
  discardVisibleAssistantMessages();
15848
- if (!terminalEmitted && !silent) {
15849
- hub.broadcastDone(topicId, queryId, undefined, { agent: agentType, model });
15850
- }
15851
15842
  const stillCurrent = getRoomQuery(roomId)?.queryId === queryId;
15852
15843
  clearRoomQuery(roomId, queryId);
15853
15844
  cancelPendingAskUserQuestions(topicId, queryId);
@@ -19189,4 +19180,4 @@ export {
19189
19180
  DEFAULT_SELF_CONFIG_PRODUCT
19190
19181
  };
19191
19182
 
19192
- //# debugId=5C27F540959207AC64756E2164756E21
19183
+ //# debugId=45ECD1D1620CDA8E64756E2164756E21