diff options
| author | Jacob Richman <[email protected]> | 2025-05-02 14:39:39 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-02 14:39:39 -0700 |
| commit | 0556358560f065dec5e35fd5b0544b18ddcc4495 (patch) | |
| tree | 8ca5ca20991b2950b2360839d35b53d3c03f34ed /packages/server/src/core/turn.ts | |
| parent | 69d1c644d9034138ed7418f4450230756e84ad93 (diff) | |
Cleanup low value comments. (#248)
Diffstat (limited to 'packages/server/src/core/turn.ts')
| -rw-r--r-- | packages/server/src/core/turn.ts | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/packages/server/src/core/turn.ts b/packages/server/src/core/turn.ts index 47ca051b..ad461d74 100644 --- a/packages/server/src/core/turn.ts +++ b/packages/server/src/core/turn.ts @@ -12,14 +12,12 @@ import { FunctionCall, FunctionDeclaration, } from '@google/genai'; -// Removed UI type imports import { ToolCallConfirmationDetails, ToolResult, ToolResultDisplay, -} from '../tools/tools.js'; // Keep ToolResult for now +} from '../tools/tools.js'; import { getResponseText } from '../utils/generateContentResponseUtilities.js'; -// Removed gemini-stream import (types defined locally) // --- Types for Server Logic --- @@ -27,7 +25,7 @@ import { getResponseText } from '../utils/generateContentResponseUtilities.js'; interface ServerToolExecutionOutcome { callId: string; name: string; - args: Record<string, unknown>; // Use unknown for broader compatibility + args: Record<string, unknown>; result?: ToolResult; error?: Error; confirmationDetails: ToolCallConfirmationDetails | undefined; @@ -36,16 +34,14 @@ interface ServerToolExecutionOutcome { // Define a structure for tools passed to the server export interface ServerTool { name: string; - schema: FunctionDeclaration; // Schema is needed + schema: FunctionDeclaration; // The execute method signature might differ slightly or be wrapped execute(params: Record<string, unknown>): Promise<ToolResult>; shouldConfirmExecute( params: Record<string, unknown>, ): Promise<ToolCallConfirmationDetails | false>; - // validation and description might be handled differently or passed } -// Redefine necessary event types locally export enum GeminiEventType { Content = 'content', ToolCallRequest = 'tool_call_request', @@ -80,15 +76,13 @@ export type ServerGeminiStreamEvent = value: ServerToolCallConfirmationDetails; }; -// --- Turn Class (Refactored for Server) --- - // A turn manages the agentic loop turn within the server context. export class Turn { - private readonly availableTools: Map<string, ServerTool>; // Use passed-in tools + private readonly availableTools: Map<string, ServerTool>; private pendingToolCalls: Array<{ callId: string; name: string; - args: Record<string, unknown>; // Use unknown + args: Record<string, unknown>; }>; private fnResponses: Part[]; private confirmationDetails: ToolCallConfirmationDetails[]; @@ -206,7 +200,6 @@ export class Turn { } } - // Generates a ToolCallRequest event to signal the need for execution private handlePendingFunctionCall( fnCall: FunctionCall, ): ServerGeminiStreamEvent | null { @@ -257,12 +250,10 @@ export class Turn { return this.confirmationDetails; } - // Allows the service layer to get the responses needed for the next API call getFunctionResponses(): Part[] { return this.fnResponses; } - // Debugging information (optional) getDebugResponses(): GenerateContentResponse[] { return this.debugResponses; } |
