summaryrefslogtreecommitdiff
path: root/packages/server/src
diff options
context:
space:
mode:
authorBrandon Keiji <[email protected]>2025-05-14 22:14:15 +0000
committerGitHub <[email protected]>2025-05-14 15:14:15 -0700
commit521708e294fe7eb16683d137e46aa36be4b9ddf5 (patch)
tree0bbbd0a3d2cdbce9a00cd5f7bd84ace1f22b39ed /packages/server/src
parent1245fe488510975b774816138e4597603851415f (diff)
refactor: break submitQuery into smaller functions (#350)
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 {