summaryrefslogtreecommitdiff
path: root/packages/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/server/src')
-rw-r--r--packages/server/src/core/turn.ts45
1 files changed, 36 insertions, 9 deletions
diff --git a/packages/server/src/core/turn.ts b/packages/server/src/core/turn.ts
index 8f473986..dd2a08ce 100644
--- a/packages/server/src/core/turn.ts
+++ b/packages/server/src/core/turn.ts
@@ -78,16 +78,43 @@ export interface ServerToolCallConfirmationDetails {
details: ToolCallConfirmationDetails;
}
+export type ServerGeminiContentEvent = {
+ type: GeminiEventType.Content;
+ value: string;
+};
+
+export type ServerGeminiToolCallRequestEvent = {
+ type: GeminiEventType.ToolCallRequest;
+ value: ToolCallRequestInfo;
+};
+
+export type ServerGeminiToolCallResponseEvent = {
+ type: GeminiEventType.ToolCallResponse;
+ value: ToolCallResponseInfo;
+};
+
+export type ServerGeminiToolCallConfirmationEvent = {
+ type: GeminiEventType.ToolCallConfirmation;
+ value: ServerToolCallConfirmationDetails;
+};
+
+export type ServerGeminiUserCancelledEvent = {
+ type: GeminiEventType.UserCancelled;
+};
+
+export type ServerGeminiErrorEvent = {
+ type: GeminiEventType.Error;
+ value: GeminiErrorEventValue;
+};
+
+// The original union type, now composed of the individual types
export type ServerGeminiStreamEvent =
- | { type: GeminiEventType.Content; value: string }
- | { type: GeminiEventType.ToolCallRequest; value: ToolCallRequestInfo }
- | { type: GeminiEventType.ToolCallResponse; value: ToolCallResponseInfo }
- | {
- type: GeminiEventType.ToolCallConfirmation;
- value: ServerToolCallConfirmationDetails;
- }
- | { type: GeminiEventType.UserCancelled }
- | { type: GeminiEventType.Error; value: GeminiErrorEventValue };
+ | ServerGeminiContentEvent
+ | ServerGeminiToolCallRequestEvent
+ | ServerGeminiToolCallResponseEvent
+ | ServerGeminiToolCallConfirmationEvent
+ | ServerGeminiUserCancelledEvent
+ | ServerGeminiErrorEvent;
// A turn manages the agentic loop turn within the server context.
export class Turn {