fix(agent): correctly strip <final> tags from reasoning providers

- Added src/utils/provider-utils.ts to track reasoning provider logic
- Updated isReasoningTagProvider to loosely match 'google-antigravity' (fixes sub-models)
- Enabled enforceFinalTag in reply.ts when provider matches
- Verified <final> tag stripping logic in pi-embedded-subscribe.ts
- Updated pi-embedded-runner to use consistent provider check for prompt hints
This commit is contained in:
Keith the Silly Goose
2026-01-12 15:50:32 +13:00
committed by Peter Steinberger
parent 7db1cbe178
commit efdf874407
5 changed files with 146 additions and 84 deletions

View File

@@ -0,0 +1,29 @@
/**
* Utility functions for provider-specific logic and capabilities.
*/
/**
* Returns true if the provider requires reasoning to be wrapped in tags
* (e.g. <think> and <final>) in the text stream, rather than using native
* API fields for reasoning/thinking.
*/
export function isReasoningTagProvider(provider: string | undefined | null): boolean {
if (!provider) return false;
const normalized = provider.trim().toLowerCase();
// Check for exact matches or known prefixes/substrings for reasoning providers
if (
normalized === "ollama" ||
normalized === "google-gemini-cli" ||
normalized === "google-generative-ai"
) {
return true;
}
// Handle google-antigravity and its model variations (e.g. google-antigravity/gemini-3)
if (normalized.includes("google-antigravity")) {
return true;
}
return false;
}