summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/cli/src/gemini.ts21
-rw-r--r--packages/server/package.json2
-rw-r--r--packages/server/src/core/client.ts49
3 files changed, 20 insertions, 52 deletions
diff --git a/packages/cli/src/gemini.ts b/packages/cli/src/gemini.ts
index 0c57e708..940a1ba8 100644
--- a/packages/cli/src/gemini.ts
+++ b/packages/cli/src/gemini.ts
@@ -86,27 +86,6 @@ async function main() {
// --- Global Unhandled Rejection Handler ---
process.on('unhandledRejection', (reason, _promise) => {
- // Check if this is the known 429 ClientError that sometimes escapes
- // this is a workaround for a specific issue with the way we are calling gemini
- // where a 429 error is thrown but not caught, causing an unhandled rejection
- // TODO(adh): Remove this when the race condition is fixed
- const isKnownEscaped429 =
- reason instanceof Error &&
- reason.name === 'ClientError' &&
- reason.message.includes('got status: 429');
-
- if (isKnownEscaped429) {
- // Log it differently and DON'T exit, as it's likely already handled visually
- console.warn('-----------------------------------------');
- console.warn(
- 'WORKAROUND: Suppressed known escaped 429 Unhandled Rejection.',
- );
- console.warn('-----------------------------------------');
- console.warn('Reason:', reason);
- return;
- // No process.exit(1); Don't exit.
- }
-
// Log other unexpected unhandled rejections as critical errors
console.error('=========================================');
console.error('CRITICAL: Unhandled Promise Rejection!');
diff --git a/packages/server/package.json b/packages/server/package.json
index f49aee0a..e20c4086 100644
--- a/packages/server/package.json
+++ b/packages/server/package.json
@@ -19,7 +19,7 @@
"dist"
],
"dependencies": {
- "@google/genai": "^0.10.0",
+ "@google/genai": "^0.13.0",
"@modelcontextprotocol/sdk": "^1.11.0",
"diff": "^7.0.0",
"dotenv": "^16.4.7",
diff --git a/packages/server/src/core/client.ts b/packages/server/src/core/client.ts
index 29712db5..904e944c 100644
--- a/packages/server/src/core/client.ts
+++ b/packages/server/src/core/client.ts
@@ -133,39 +133,28 @@ export class GeminiClient {
): AsyncGenerator<ServerGeminiStreamEvent> {
let turns = 0;
const availableTools = this.config.getToolRegistry().getAllTools();
- try {
- while (turns < this.MAX_TURNS) {
- turns++;
- const turn = new Turn(chat, availableTools);
- const resultStream = turn.run(request, signal);
- for await (const event of resultStream) {
- yield event;
- }
-
- const confirmations = turn.getConfirmationDetails();
- if (confirmations.length > 0) {
- break;
- }
-
- // What do we do when we have both function responses and confirmations?
- const fnResponses = turn.getFunctionResponses();
- if (fnResponses.length === 0) {
- break; // user's turn to respond
- }
- request = fnResponses;
+ while (turns < this.MAX_TURNS) {
+ turns++;
+ const turn = new Turn(chat, availableTools);
+ const resultStream = turn.run(request, signal);
+ for await (const event of resultStream) {
+ yield event;
}
- if (turns >= this.MAX_TURNS) {
- console.warn(
- 'sendMessageStream: Reached maximum tool call turns limit.',
- );
+
+ const confirmations = turn.getConfirmationDetails();
+ if (confirmations.length > 0) {
+ break;
}
- } catch (error: unknown) {
- if (error instanceof Error && error.name === 'AbortError') {
- console.log('Gemini stream request aborted by user.');
- throw error;
+
+ // What do we do when we have both function responses and confirmations?
+ const fnResponses = turn.getFunctionResponses();
+ if (fnResponses.length === 0) {
+ break; // user's turn to respond
}
- console.error(`Error during Gemini stream or tool interaction:`, error);
- throw error;
+ request = fnResponses;
+ }
+ if (turns >= this.MAX_TURNS) {
+ console.warn('sendMessageStream: Reached maximum tool call turns limit.');
}
}