feat: added toolChoice support and optimized TUI

- Added ToolChoice type and toolChoice parameter support across all AI providers (OpenAI, Azure OpenAI, Anthropic, Google) enabling fine-grained control over tool/function selection during LLM calls.
- Added toolChoice override capability to Agent.prompt() method and session prompt options allowing callers to control tool selection behavior per request.
- Added provider-specific tool choice mapping functions (mapAnthropicToolChoice, mapGoogleToolChoice, mapOpenAiToolChoice) to normalize tool choice formats across different LLM APIs.
- Removed kernel heartbeat/ping mechanism from PythonKernel, simplifying health monitoring by relying on direct isAlive() checks instead of periodic HTTP requests.
This commit is contained in:
can1357
2026-01-28 02:39:28 +01:00
parent 6b96418f87
commit cc91f80e99
21 changed files with 392 additions and 167 deletions
+3 -5
View File
@@ -303,6 +303,8 @@ class AnsiCodeTracker {
}
}
const WRAP_OPTIONS = { wordWrap: true, hard: true, trim: false } as const;
/**
* Wrap text with ANSI codes preserved.
*
@@ -315,11 +317,7 @@ class AnsiCodeTracker {
* @returns Array of wrapped lines (NOT padded to width)
*/
export function wrapTextWithAnsi(text: string, width: number): string[] {
if (!text) {
return [""];
}
return Bun.wrapAnsi(text, width, { wordWrap: true, hard: true, trim: false }).split("\n");
return Bun.wrapAnsi(text, width, WRAP_OPTIONS).split("\n");
}
const PUNCTUATION_REGEX = /[(){}[\]<>.,;:'"!?+\-=*/\\|&%^$#@~`]/;