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:
@@ -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 = /[(){}[\]<>.,;:'"!?+\-=*/\\|&%^$#@~`]/;
|
||||
|
||||
Reference in New Issue
Block a user