negotium 0.12.0 → 0.12.2

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.
Files changed (34) hide show
  1. package/dist/agent-helpers.js +14 -7
  2. package/dist/agent-helpers.js.map +8 -8
  3. package/dist/{chunk-tvx2tm5q.js → chunk-bw6mrsc6.js} +3 -3
  4. package/dist/{chunk-tvx2tm5q.js.map → chunk-bw6mrsc6.js.map} +2 -2
  5. package/dist/{chunk-4drjv7x2.js → chunk-jz4jf6t1.js} +5 -1
  6. package/dist/{chunk-4drjv7x2.js.map → chunk-jz4jf6t1.js.map} +4 -4
  7. package/dist/{chunk-q1fta5e3.js → chunk-v9vh52nc.js} +1 -1
  8. package/dist/hosted-agent.js +6 -2
  9. package/dist/hosted-agent.js.map +5 -5
  10. package/dist/main.js +17 -7
  11. package/dist/main.js.map +11 -11
  12. package/dist/mcp-factories.js +15 -7
  13. package/dist/mcp-factories.js.map +9 -9
  14. package/dist/query-runtime.js +2 -2
  15. package/dist/query-runtime.js.map +3 -3
  16. package/dist/registry.js +3 -3
  17. package/dist/rollout.js +2 -2
  18. package/dist/runtime/src/mcp/runtime-spec.ts +12 -0
  19. package/dist/runtime/src/mcp/session-comm/context.ts +3 -0
  20. package/dist/runtime/src/mcp/session-comm/default-host.ts +3 -0
  21. package/dist/runtime/src/platform/mcp-config.ts +6 -0
  22. package/dist/runtime/src/query/active-rooms.ts +3 -0
  23. package/dist/runtime/src/runtime/ask-callbacks.ts +2 -0
  24. package/dist/runtime/src/runtime/inbox.ts +9 -0
  25. package/dist/runtime/src/runtime/turn-runner.ts +24 -2
  26. package/dist/runtime/src/version.ts +1 -1
  27. package/dist/types/packages/core/src/mcp/runtime-spec.d.ts +8 -0
  28. package/dist/types/packages/core/src/mcp/session-comm/context.d.ts +2 -0
  29. package/dist/types/packages/core/src/query/active-rooms.d.ts +2 -0
  30. package/dist/types/packages/core/src/runtime/ask-callbacks.d.ts +2 -0
  31. package/dist/types/packages/core/src/runtime/turn-runner.d.ts +1 -0
  32. package/dist/types/packages/core/src/version.d.ts +1 -1
  33. package/package.json +1 -1
  34. /package/dist/{chunk-q1fta5e3.js.map → chunk-v9vh52nc.js.map} +0 -0
package/dist/main.js CHANGED
@@ -2184,6 +2184,7 @@ function hostedMcpCacheIdentity(surface, ctx) {
2184
2184
  depth: ctx.depth ?? 0,
2185
2185
  silent: ctx.silent ?? false,
2186
2186
  agent: ctx.agent,
2187
+ threadRootId: ctx.threadRootId ?? null,
2187
2188
  peerBridge: ctx.peerBridge ?? null
2188
2189
  };
2189
2190
  break;
@@ -2596,6 +2597,7 @@ function buildBuiltinMcpServer(surface, ctx, stdio) {
2596
2597
  ...ctx.queryId ? { queryId: ctx.queryId } : {},
2597
2598
  ...ctx.wikiTopicId ? { wikiTopicId: ctx.wikiTopicId } : {},
2598
2599
  ...ctx.subagentParentTopicId ? { subagentParentTopicId: ctx.subagentParentTopicId } : {},
2600
+ ...ctx.threadRootId ? { threadRootId: ctx.threadRootId } : {},
2599
2601
  cwd: ctx.cwd ?? (ctx.topicId ? resolveTopicWorkspaceDir(ctx.topicId) : process.cwd()),
2600
2602
  agent,
2601
2603
  ...ctx.model ? { model: ctx.model } : {},
@@ -3078,6 +3080,7 @@ var init_mcp_config = __esm(() => {
3078
3080
  agent,
3079
3081
  depth = 0,
3080
3082
  silent,
3083
+ threadRootId,
3081
3084
  peerBridge
3082
3085
  } = ctx;
3083
3086
  const effectiveAgent = agent ?? FALLBACK_AGENT;
@@ -3091,6 +3094,7 @@ var init_mcp_config = __esm(() => {
3091
3094
  `--agent=${effectiveAgent}`,
3092
3095
  ...cronSessionId ? [`--cron-session-id=${cronSessionId}`] : [],
3093
3096
  ...silent ? ["--reply-only=true"] : [],
3097
+ ...threadRootId ? [`--thread-root-id=${threadRootId}`] : [],
3094
3098
  ...peerBridge ? [`--peer-host-query-id=${peerBridge.hostQueryId}`] : []
3095
3099
  ];
3096
3100
  return buildBuiltinMcpServer("session-comm", ctx, () => buildStdioMcpServer(effectiveAgent, SESSION_COMM_SERVER, args, peerBridge ? peerSessionBridgeIpcEnv() : undefined));
@@ -3776,7 +3780,7 @@ var exports_version = {};
3776
3780
  __export(exports_version, {
3777
3781
  NEGOTIUM_VERSION: () => NEGOTIUM_VERSION
3778
3782
  });
3779
- var NEGOTIUM_VERSION = "0.12.0";
3783
+ var NEGOTIUM_VERSION = "0.12.2";
3780
3784
 
3781
3785
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
3782
3786
  import { spawn as spawn2 } from "child_process";
@@ -11939,7 +11943,7 @@ class InterSessionQueue {
11939
11943
  const base = bucket.items[bucket.head];
11940
11944
  const isAskReplyInject = (e) => !e.silent && Boolean(e.askReplySources?.length);
11941
11945
  const baseIsAskReplyInject = isAskReplyInject(base);
11942
- const mergeable = (e) => (baseIsAskReplyInject ? isAskReplyInject(e) : !isAskReplyInject(e) && e.origin === base.origin && (e.silent ?? false) === (base.silent ?? false)) && e.onDispatched !== undefined === (base.onDispatched !== undefined) && (e.agentOverride ?? null) === (base.agentOverride ?? null) && (e.modelOverride ?? null) === (base.modelOverride ?? null) && (e.effortOverride ?? null) === (base.effortOverride ?? null) && (e.runtimeEpoch ?? 0) === (base.runtimeEpoch ?? 0) && (e.sessionId ?? null) === (base.sessionId ?? null) && (e.forkHandle?.forkId ?? null) === (base.forkHandle?.forkId ?? null) && (e.prepareSession ?? null) === (base.prepareSession ?? null) && (e.cwd ?? null) === (base.cwd ?? null) && (e.sessionName ?? null) === (base.sessionName ?? null) && (e.sessionType ?? null) === (base.sessionType ?? null) && (e.onSessionId ?? null) === (base.onSessionId ?? null) && (e.onSessionReset ?? null) === (base.onSessionReset ?? null) && (e.bridgeSessionFromHistory ?? false) === (base.bridgeSessionFromHistory ?? false) && (e.onSettled ?? null) === (base.onSettled ?? null);
11946
+ const mergeable = (e) => (baseIsAskReplyInject ? isAskReplyInject(e) : !isAskReplyInject(e) && e.origin === base.origin && (e.silent ?? false) === (base.silent ?? false)) && (e.threadRootId ?? null) === (base.threadRootId ?? null) && e.onDispatched !== undefined === (base.onDispatched !== undefined) && (e.agentOverride ?? null) === (base.agentOverride ?? null) && (e.modelOverride ?? null) === (base.modelOverride ?? null) && (e.effortOverride ?? null) === (base.effortOverride ?? null) && (e.runtimeEpoch ?? 0) === (base.runtimeEpoch ?? 0) && (e.sessionId ?? null) === (base.sessionId ?? null) && (e.forkHandle?.forkId ?? null) === (base.forkHandle?.forkId ?? null) && (e.prepareSession ?? null) === (base.prepareSession ?? null) && (e.cwd ?? null) === (base.cwd ?? null) && (e.sessionName ?? null) === (base.sessionName ?? null) && (e.sessionType ?? null) === (base.sessionType ?? null) && (e.onSessionId ?? null) === (base.onSessionId ?? null) && (e.onSessionReset ?? null) === (base.onSessionReset ?? null) && (e.bridgeSessionFromHistory ?? false) === (base.bridgeSessionFromHistory ?? false) && (e.onSettled ?? null) === (base.onSettled ?? null);
11943
11947
  let end = bucket.head + 1;
11944
11948
  while (end < bucket.items.length && mergeable(bucket.items[end]))
11945
11949
  end++;
@@ -19444,7 +19448,7 @@ function notifyPlaywrightUnavailable(topicId) {
19444
19448
  appendSystemMessage(topicId, "Playwright browser tools are unavailable this turn. Browser automation was removed from the tool catalog; retry shortly if browser interaction is required.");
19445
19449
  WsHub.get().broadcastTopicNotice(topicId, "info", "Playwright \uC0AC\uC6A9 \uBD88\uAC00");
19446
19450
  }
19447
- function appendAskReplyMessage(topicId, text2, sourceLabel, body, kind, agentType) {
19451
+ function appendAskReplyMessage(topicId, text2, sourceLabel, body, kind, agentType, threadRootId) {
19448
19452
  const message = {
19449
19453
  id: randomUUID17(),
19450
19454
  topicId,
@@ -19457,6 +19461,7 @@ function appendAskReplyMessage(topicId, text2, sourceLabel, body, kind, agentTyp
19457
19461
  message: body
19458
19462
  },
19459
19463
  ...agentType ? { agentType } : {},
19464
+ ...threadRootId ? { threadRootId } : {},
19460
19465
  createdAt: new Date().toISOString()
19461
19466
  };
19462
19467
  appendApiMessage(message, { notify: false });
@@ -19538,6 +19543,7 @@ function redispatchInject(inject) {
19538
19543
  depth: inject.depth,
19539
19544
  silent: inject.silent,
19540
19545
  contextId: inject.contextId,
19546
+ ...inject.threadRootId ? { threadRootId: inject.threadRootId } : {},
19541
19547
  agentOverride: inject.agentOverride,
19542
19548
  modelOverride: inject.modelOverride,
19543
19549
  effortOverride: inject.effortOverride,
@@ -19598,7 +19604,7 @@ ${body}`;
19598
19604
  await markPendingAskFile(pending, "reply_ready");
19599
19605
  if (!callerTopic?.agent) {
19600
19606
  try {
19601
- appendAskReplyMessage(pending.callerTopicId, prompt, sourceLabel, body, kind);
19607
+ appendAskReplyMessage(pending.callerTopicId, prompt, sourceLabel, body, kind, undefined, pending.callerThreadRootId);
19602
19608
  await clearPendingAskFile(pending);
19603
19609
  return true;
19604
19610
  } catch (err2) {
@@ -19609,6 +19615,7 @@ ${body}`;
19609
19615
  const queued = askReplyInjectBatcher.enqueue({
19610
19616
  topicId: pending.callerTopicId,
19611
19617
  userId: pending.callerUserId,
19618
+ ...pending.callerThreadRootId ? { threadRootId: pending.callerThreadRootId } : {},
19612
19619
  prompt,
19613
19620
  origin: sourceLabel,
19614
19621
  requestId: pending.requestId,
@@ -19628,7 +19635,7 @@ ${body}`;
19628
19635
  }
19629
19636
  });
19630
19637
  if (queued) {
19631
- appendAskReplyMessage(pending.callerTopicId, prompt, sourceLabel, body, kind, callerTopic.agent);
19638
+ appendAskReplyMessage(pending.callerTopicId, prompt, sourceLabel, body, kind, callerTopic.agent, pending.callerThreadRootId);
19632
19639
  await markPendingAskFile(pending, "queued_for_caller");
19633
19640
  return true;
19634
19641
  }
@@ -19637,7 +19644,7 @@ ${body}`;
19637
19644
  return true;
19638
19645
  }
19639
19646
  logger.warn({ requestId: pending.requestId, callerTopicId: pending.callerTopicId, source: sourceLabel }, "sessions: ask callback could not enter caller batch; appending direct fallback");
19640
- appendAskReplyMessage(pending.callerTopicId, prompt, sourceLabel, body, kind, callerTopic.agent);
19647
+ appendAskReplyMessage(pending.callerTopicId, prompt, sourceLabel, body, kind, callerTopic.agent, pending.callerThreadRootId);
19641
19648
  await clearPendingAskFile(pending);
19642
19649
  return true;
19643
19650
  }
@@ -24077,6 +24084,7 @@ ${entry.message}
24077
24084
  requestId,
24078
24085
  contextId: entry.contextId,
24079
24086
  callerTopicId,
24087
+ ...entry.fromThreadRootId ? { callerThreadRootId: entry.fromThreadRootId } : {},
24080
24088
  callerUserId: String(scope.userId),
24081
24089
  targetQueryId: queryId,
24082
24090
  createdAt: Date.now(),
@@ -26953,6 +26961,7 @@ ${entries.join(`
26953
26961
  from: from.key,
26954
26962
  fromTitle: from.title,
26955
26963
  ...from.topicId ? { fromTopicId: from.topicId } : {},
26964
+ ...context.currentThreadRootId ? { fromThreadRootId: context.currentThreadRootId } : {},
26956
26965
  message,
26957
26966
  fromDepth: context.depth,
26958
26967
  timestamp: new Date().toISOString()
@@ -29958,6 +29967,7 @@ async function buildHostedSurfaceServer(surface, context) {
29958
29967
  userId: context.userId,
29959
29968
  currentTopic: context.topicTitle,
29960
29969
  currentTopicId: context.topicId,
29970
+ currentThreadRootId: context.threadRootId,
29961
29971
  subagentParentTopicId: context.subagentParentTopicId,
29962
29972
  peerHostQueryId: context.peerBridge?.hostQueryId,
29963
29973
  depth: context.depth ?? 0,
@@ -50764,4 +50774,4 @@ switch (command) {
50764
50774
  }
50765
50775
  }
50766
50776
 
50767
- //# debugId=508344C759B086A364756E2164756E21
50777
+ //# debugId=60B98B6B10E61F0664756E2164756E21