@fangyb/ahchat-bridge 0.1.36 → 0.1.37

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
@@ -116861,9 +116861,12 @@ function isAuthFailureText(text, sdkError) {
116861
116861
  function isProviderApiErrorText(text) {
116862
116862
  return /^API Error:\s*\d+/i.test(text.trim());
116863
116863
  }
116864
- function isNoReplyText(text) {
116864
+ function isSdkSyntheticNoResponseText(normalizedText) {
116865
+ return normalizedText.replace(/[.!。]+$/g, "") === "no response requested";
116866
+ }
116867
+ function isNoReplyText(text, opts) {
116865
116868
  const normalized = text.trim().replace(/^`+|`+$/g, "").trim().toLowerCase();
116866
- return normalized === NO_REPLY_TOKEN || normalized === "<no-reply>" || normalized === "no-reply" || normalized === "no_reply" || normalized === "no reply";
116869
+ return normalized === NO_REPLY_TOKEN || normalized === "<no-reply>" || normalized === "no-reply" || normalized === "no_reply" || normalized === "no reply" || opts?.allowSdkSyntheticNoResponse === true && isSdkSyntheticNoResponseText(normalized);
116867
116870
  }
116868
116871
  function decodeJsonStringFragment(raw) {
116869
116872
  let out = "";
@@ -117353,7 +117356,7 @@ function emitGroupSegment(proc, emit, base, content, contentBlocks, isSilent = f
117353
117356
  }
117354
117357
  function flushTextSegmentOnBlockStop(proc, emit, base) {
117355
117358
  const trimmed = proc.segmentBuffer.trim();
117356
- const isSilent = isNoReplyText(trimmed);
117359
+ const isSilent = isNoReplyText(trimmed, { allowSdkSyntheticNoResponse: true });
117357
117360
  const isEmpty = trimmed.length === 0;
117358
117361
  if (!isEmpty) {
117359
117362
  const blocksForSegment = [...proc.contentBlocks, { type: "text", content: proc.segmentBuffer }];
@@ -117876,7 +117879,7 @@ function mapSDKMessage(proc, message, rawEmit, sessionStore, onCompleted, onProv
117876
117879
  const groupMode = groupId != null;
117877
117880
  const usage = extractUsage(successMsg);
117878
117881
  const watermarkUsage = proc.peakContextUsage ?? usage;
117879
- if (isNoReplyText(trimmed)) {
117882
+ if (isNoReplyText(trimmed, { allowSdkSyntheticNoResponse: groupMode })) {
117880
117883
  checkInputTokenWatermark(proc, watermarkUsage, base.traceId);
117881
117884
  emitUsageReported(proc, emit, base, usage);
117882
117885
  if (groupMode && proc.contentBlocks.length > 0) {
package/dist/index.js CHANGED
@@ -28087,9 +28087,12 @@ function isAuthFailureText(text, sdkError) {
28087
28087
  function isProviderApiErrorText(text) {
28088
28088
  return /^API Error:\s*\d+/i.test(text.trim());
28089
28089
  }
28090
- function isNoReplyText(text) {
28090
+ function isSdkSyntheticNoResponseText(normalizedText) {
28091
+ return normalizedText.replace(/[.!。]+$/g, "") === "no response requested";
28092
+ }
28093
+ function isNoReplyText(text, opts) {
28091
28094
  const normalized = text.trim().replace(/^`+|`+$/g, "").trim().toLowerCase();
28092
- return normalized === NO_REPLY_TOKEN || normalized === "<no-reply>" || normalized === "no-reply" || normalized === "no_reply" || normalized === "no reply";
28095
+ return normalized === NO_REPLY_TOKEN || normalized === "<no-reply>" || normalized === "no-reply" || normalized === "no_reply" || normalized === "no reply" || opts?.allowSdkSyntheticNoResponse === true && isSdkSyntheticNoResponseText(normalized);
28093
28096
  }
28094
28097
  function decodeJsonStringFragment(raw) {
28095
28098
  let out = "";
@@ -28579,7 +28582,7 @@ function emitGroupSegment(proc, emit, base, content, contentBlocks, isSilent = f
28579
28582
  }
28580
28583
  function flushTextSegmentOnBlockStop(proc, emit, base) {
28581
28584
  const trimmed = proc.segmentBuffer.trim();
28582
- const isSilent = isNoReplyText(trimmed);
28585
+ const isSilent = isNoReplyText(trimmed, { allowSdkSyntheticNoResponse: true });
28583
28586
  const isEmpty = trimmed.length === 0;
28584
28587
  if (!isEmpty) {
28585
28588
  const blocksForSegment = [...proc.contentBlocks, { type: "text", content: proc.segmentBuffer }];
@@ -29102,7 +29105,7 @@ function mapSDKMessage(proc, message, rawEmit, sessionStore, onCompleted, onProv
29102
29105
  const groupMode = groupId != null;
29103
29106
  const usage = extractUsage(successMsg);
29104
29107
  const watermarkUsage = proc.peakContextUsage ?? usage;
29105
- if (isNoReplyText(trimmed)) {
29108
+ if (isNoReplyText(trimmed, { allowSdkSyntheticNoResponse: groupMode })) {
29106
29109
  checkInputTokenWatermark(proc, watermarkUsage, base.traceId);
29107
29110
  emitUsageReported(proc, emit, base, usage);
29108
29111
  if (groupMode && proc.contentBlocks.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fangyb/ahchat-bridge",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
4
4
  "files": [
5
5
  "dist"
6
6
  ],