refactor(text): remove unused final tag predicate

This commit is contained in:
Vincent Koc
2026-06-19 01:16:31 +08:00
parent 65eb2ccd4a
commit 361320cd9f
2 changed files with 2 additions and 7 deletions

View File

@@ -58,7 +58,7 @@ import { resolveProviderThinkingProfile } from "../plugins/provider-runtime.js";
import type { ProviderThinkingModelCompat } from "../plugins/provider-thinking.types.js";
import { DEFAULT_AGENT_ID } from "../routing/session-key.js";
import { stripAssistantInternalScaffolding } from "../shared/text/assistant-visible-text.js";
import { containsFinalTag, stripFinalTags } from "../shared/text/final-tags.js";
import { findFinalTagMatches, stripFinalTags } from "../shared/text/final-tags.js";
import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js";
import { GatewayClient } from "./client.js";
import {
@@ -598,7 +598,7 @@ function assertNoReasoningTags(params: {
if (!params.text) {
return;
}
if (THINKING_TAG_RE.test(params.text) || containsFinalTag(params.text)) {
if (THINKING_TAG_RE.test(params.text) || findFinalTagMatches(params.text).length > 0) {
const snippet = params.text.length > 200 ? `${params.text.slice(0, 200)}` : params.text;
throw new Error(
`[${params.label}] reasoning tag leak (${params.model} / ${params.phase}): ${snippet}`,

View File

@@ -130,11 +130,6 @@ export function findFinalTagMatches(text: string): FinalTagMatch[] {
return matches;
}
/** Returns true when text contains at least one valid `<final>` control tag. */
export function containsFinalTag(text: string): boolean {
return findFinalTagMatches(text).length > 0;
}
/** Removes valid `<final>` tags while preserving their enclosed visible answer text. */
export function stripFinalTags(text: string): string {
let output = "";