@ai-sdk/harness 1.0.0-canary.9 → 1.0.1

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.
@@ -675,12 +675,14 @@ export async function runBridge<TStart extends { type: 'start' }>(
675
675
  emit({ type: 'error', error: serialiseError(err) });
676
676
  });
677
677
 
678
- await new Promise<void>(resolve => {
678
+ await new Promise<void>((resolve, reject) => {
679
679
  if (wss.address() != null) {
680
680
  resolve();
681
681
  return;
682
682
  }
683
- wss.on('listening', () => resolve());
683
+
684
+ wss.once('listening', resolve);
685
+ wss.once('error', reject);
684
686
  });
685
687
 
686
688
  return {
@@ -0,0 +1,15 @@
1
+ const DEFAULT_AI_GATEWAY_BASE_URL = 'https://ai-gateway.vercel.sh';
2
+
3
+ export function getAiGatewayAuthFromEnv({
4
+ env,
5
+ }: {
6
+ env: Record<string, string | undefined>;
7
+ }): {
8
+ apiKey: string | undefined;
9
+ baseUrl: string;
10
+ } {
11
+ return {
12
+ apiKey: env.AI_GATEWAY_API_KEY || env.VERCEL_OIDC_TOKEN || undefined,
13
+ baseUrl: env.AI_GATEWAY_BASE_URL ?? DEFAULT_AI_GATEWAY_BASE_URL,
14
+ };
15
+ }
@@ -5,6 +5,7 @@ export {
5
5
  type SandboxChannelReconnectOptions,
6
6
  } from './sandbox-channel';
7
7
  export { classifyDiskLog, type DiskLogRecoveryMode } from './classify-disk-log';
8
+ export { getAiGatewayAuthFromEnv } from './ai-gateway-auth';
8
9
  export {
9
10
  markBridgeStarting,
10
11
  waitForBridgeReady,