@fangyb/ahchat-bridge 0.1.39 → 0.1.40

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/cli.cjs CHANGED
@@ -117680,6 +117680,7 @@ function mapSDKMessage(proc, message, rawEmit, sessionStore, onCompleted, onPost
117680
117680
  const isMcpTool = parseMcpRuntimeToolName(toolName) != null;
117681
117681
  proc.currentMcpInvocationId = isMcpTool ? createMcpToolInvocationId() : null;
117682
117682
  proc.currentMcpInvocationStartedAt = isMcpTool ? (/* @__PURE__ */ new Date()).toISOString() : null;
117683
+ proc.currentMcpInvocationToolUseId = isMcpTool ? toolUseId ?? null : null;
117683
117684
  if (shouldStreamInternals(proc) && !proc.suppressCurrentToolUse && toolName !== "ExitPlanMode" && !isAskUserQuestionToolName(toolName)) {
117684
117685
  emit({
117685
117686
  type: "agent:tool_use",
@@ -117866,6 +117867,14 @@ function mapSDKMessage(proc, message, rawEmit, sessionStore, onCompleted, onPost
117866
117867
  }
117867
117868
  if (proc.currentToolName && !proc.suppressCurrentToolUse && proc.currentMcpInvocationId && proc.currentMcpInvocationStartedAt && parseMcpRuntimeToolName(proc.currentToolName)) {
117868
117869
  try {
117870
+ logger12.info("MCP audit start paired with tool_use", {
117871
+ agentId: proc.agentId,
117872
+ replyMessageId: base.replyMessageId,
117873
+ traceId: base.traceId,
117874
+ toolUseId: proc.currentMcpInvocationToolUseId ?? null,
117875
+ runtimeToolName: proc.currentToolName,
117876
+ mcpInvocationId: proc.currentMcpInvocationId
117877
+ });
117869
117878
  proc.mcpAuditRecorder?.recordStart({
117870
117879
  id: proc.currentMcpInvocationId,
117871
117880
  runtimeToolName: proc.currentToolName,
@@ -117946,6 +117955,7 @@ function mapSDKMessage(proc, message, rawEmit, sessionStore, onCompleted, onPost
117946
117955
  });
117947
117956
  proc.currentMcpInvocationId = null;
117948
117957
  proc.currentMcpInvocationStartedAt = null;
117958
+ proc.currentMcpInvocationToolUseId = null;
117949
117959
  proc.activeToolUseStartedAt = void 0;
117950
117960
  proc.currentToolName = null;
117951
117961
  proc.currentToolUseId = null;
@@ -117962,6 +117972,16 @@ function mapSDKMessage(proc, message, rawEmit, sessionStore, onCompleted, onPost
117962
117972
  }
117963
117973
  if (proc.currentMcpInvocationId && parseMcpRuntimeToolName(toolName)) {
117964
117974
  try {
117975
+ logger12.info("MCP audit result paired with tool_result", {
117976
+ agentId: proc.agentId,
117977
+ replyMessageId: base.replyMessageId,
117978
+ traceId: base.traceId,
117979
+ toolUseId,
117980
+ startedToolUseId: proc.currentMcpInvocationToolUseId ?? null,
117981
+ runtimeToolName: toolName,
117982
+ mcpInvocationId: proc.currentMcpInvocationId,
117983
+ isError
117984
+ });
117965
117985
  proc.mcpAuditRecorder?.recordResult({
117966
117986
  id: proc.currentMcpInvocationId,
117967
117987
  runtimeToolName: toolName,
@@ -117983,6 +118003,7 @@ function mapSDKMessage(proc, message, rawEmit, sessionStore, onCompleted, onPost
117983
118003
  }
117984
118004
  proc.currentMcpInvocationId = null;
117985
118005
  proc.currentMcpInvocationStartedAt = null;
118006
+ proc.currentMcpInvocationToolUseId = null;
117986
118007
  }
117987
118008
  if (shouldStreamInternals(proc)) {
117988
118009
  emit({
@@ -118396,6 +118417,7 @@ function resetAccumulators(proc) {
118396
118417
  proc.currentToolUseId = null;
118397
118418
  proc.currentMcpInvocationId = null;
118398
118419
  proc.currentMcpInvocationStartedAt = null;
118420
+ proc.currentMcpInvocationToolUseId = null;
118399
118421
  proc.activeToolUseStartedAt = void 0;
118400
118422
  proc.segmentBuffer = "";
118401
118423
  proc.segmentCount = 0;
package/dist/index.js CHANGED
@@ -28905,6 +28905,7 @@ function mapSDKMessage(proc, message, rawEmit, sessionStore, onCompleted, onPost
28905
28905
  const isMcpTool = parseMcpRuntimeToolName(toolName) != null;
28906
28906
  proc.currentMcpInvocationId = isMcpTool ? createMcpToolInvocationId() : null;
28907
28907
  proc.currentMcpInvocationStartedAt = isMcpTool ? (/* @__PURE__ */ new Date()).toISOString() : null;
28908
+ proc.currentMcpInvocationToolUseId = isMcpTool ? toolUseId ?? null : null;
28908
28909
  if (shouldStreamInternals(proc) && !proc.suppressCurrentToolUse && toolName !== "ExitPlanMode" && !isAskUserQuestionToolName(toolName)) {
28909
28910
  emit({
28910
28911
  type: "agent:tool_use",
@@ -29091,6 +29092,14 @@ function mapSDKMessage(proc, message, rawEmit, sessionStore, onCompleted, onPost
29091
29092
  }
29092
29093
  if (proc.currentToolName && !proc.suppressCurrentToolUse && proc.currentMcpInvocationId && proc.currentMcpInvocationStartedAt && parseMcpRuntimeToolName(proc.currentToolName)) {
29093
29094
  try {
29095
+ logger11.info("MCP audit start paired with tool_use", {
29096
+ agentId: proc.agentId,
29097
+ replyMessageId: base.replyMessageId,
29098
+ traceId: base.traceId,
29099
+ toolUseId: proc.currentMcpInvocationToolUseId ?? null,
29100
+ runtimeToolName: proc.currentToolName,
29101
+ mcpInvocationId: proc.currentMcpInvocationId
29102
+ });
29094
29103
  proc.mcpAuditRecorder?.recordStart({
29095
29104
  id: proc.currentMcpInvocationId,
29096
29105
  runtimeToolName: proc.currentToolName,
@@ -29171,6 +29180,7 @@ function mapSDKMessage(proc, message, rawEmit, sessionStore, onCompleted, onPost
29171
29180
  });
29172
29181
  proc.currentMcpInvocationId = null;
29173
29182
  proc.currentMcpInvocationStartedAt = null;
29183
+ proc.currentMcpInvocationToolUseId = null;
29174
29184
  proc.activeToolUseStartedAt = void 0;
29175
29185
  proc.currentToolName = null;
29176
29186
  proc.currentToolUseId = null;
@@ -29187,6 +29197,16 @@ function mapSDKMessage(proc, message, rawEmit, sessionStore, onCompleted, onPost
29187
29197
  }
29188
29198
  if (proc.currentMcpInvocationId && parseMcpRuntimeToolName(toolName)) {
29189
29199
  try {
29200
+ logger11.info("MCP audit result paired with tool_result", {
29201
+ agentId: proc.agentId,
29202
+ replyMessageId: base.replyMessageId,
29203
+ traceId: base.traceId,
29204
+ toolUseId,
29205
+ startedToolUseId: proc.currentMcpInvocationToolUseId ?? null,
29206
+ runtimeToolName: toolName,
29207
+ mcpInvocationId: proc.currentMcpInvocationId,
29208
+ isError
29209
+ });
29190
29210
  proc.mcpAuditRecorder?.recordResult({
29191
29211
  id: proc.currentMcpInvocationId,
29192
29212
  runtimeToolName: toolName,
@@ -29208,6 +29228,7 @@ function mapSDKMessage(proc, message, rawEmit, sessionStore, onCompleted, onPost
29208
29228
  }
29209
29229
  proc.currentMcpInvocationId = null;
29210
29230
  proc.currentMcpInvocationStartedAt = null;
29231
+ proc.currentMcpInvocationToolUseId = null;
29211
29232
  }
29212
29233
  if (shouldStreamInternals(proc)) {
29213
29234
  emit({
@@ -29621,6 +29642,7 @@ function resetAccumulators(proc) {
29621
29642
  proc.currentToolUseId = null;
29622
29643
  proc.currentMcpInvocationId = null;
29623
29644
  proc.currentMcpInvocationStartedAt = null;
29645
+ proc.currentMcpInvocationToolUseId = null;
29624
29646
  proc.activeToolUseStartedAt = void 0;
29625
29647
  proc.segmentBuffer = "";
29626
29648
  proc.segmentCount = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fangyb/ahchat-bridge",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "files": [
5
5
  "dist"
6
6
  ],