@agi-cli/server 0.1.156 → 0.1.157

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agi-cli/server",
3
- "version": "0.1.156",
3
+ "version": "0.1.157",
4
4
  "description": "HTTP API server for AGI CLI",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -29,8 +29,8 @@
29
29
  "typecheck": "tsc --noEmit"
30
30
  },
31
31
  "dependencies": {
32
- "@agi-cli/sdk": "0.1.156",
33
- "@agi-cli/database": "0.1.156",
32
+ "@agi-cli/sdk": "0.1.157",
33
+ "@agi-cli/database": "0.1.157",
34
34
  "drizzle-orm": "^0.44.5",
35
35
  "hono": "^4.9.9",
36
36
  "zod": "^4.1.8"
@@ -235,7 +235,11 @@ export function registerAuthRoutes(app: Hono) {
235
235
  return c.json({ error: 'Session expired or invalid' }, 400);
236
236
  }
237
237
 
238
- const { verifier } = oauthVerifiers.get(sessionId)!;
238
+ const verifierEntry = oauthVerifiers.get(sessionId);
239
+ if (!verifierEntry) {
240
+ return c.json({ error: 'Session expired or invalid' }, 400);
241
+ }
242
+ const { verifier } = verifierEntry;
239
243
  oauthVerifiers.delete(sessionId);
240
244
 
241
245
  if (provider === 'anthropic') {
@@ -351,12 +355,18 @@ export function registerAuthRoutes(app: Hono) {
351
355
  );
352
356
  }
353
357
 
354
- const { verifier, callbackUrl } = oauthVerifiers.get(sessionId)!;
358
+ const callbackEntry = oauthVerifiers.get(sessionId);
359
+ if (!callbackEntry) {
360
+ return c.html(
361
+ '<html><body><h1>Session expired</h1><p>Please close this window and try again.</p><script>setTimeout(() => window.close(), 3000);</script></body></html>',
362
+ );
363
+ }
364
+ const { verifier, callbackUrl } = callbackEntry;
355
365
  oauthVerifiers.delete(sessionId);
356
366
 
357
367
  if (provider === 'anthropic') {
358
- const fullCode = fragment ? `${code}#${fragment}` : code;
359
- const tokens = await exchangeWeb(fullCode!, verifier, callbackUrl);
368
+ const fullCode = fragment ? `${code}#${fragment}` : (code ?? '');
369
+ const tokens = await exchangeWeb(fullCode, verifier, callbackUrl);
360
370
 
361
371
  await setAuth(
362
372
  'anthropic',
@@ -244,7 +244,7 @@ export async function setupRunner(opts: RunOpts): Promise<SetupResult> {
244
244
  thinkingConfig: { thinkingBudget: THINKING_BUDGET },
245
245
  };
246
246
  } else if (underlyingProvider === 'openai-compatible') {
247
- providerOptions['openaiCompatible'] = {
247
+ providerOptions.openaiCompatible = {
248
248
  reasoningEffort: 'high',
249
249
  };
250
250
  }