@ai-sdk/harness-claude-code 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.
@@ -9,121 +9,121 @@ importers:
9
9
  .:
10
10
  dependencies:
11
11
  '@anthropic-ai/claude-agent-sdk':
12
- specifier: 0.3.146
13
- version: 0.3.146(@anthropic-ai/sdk@0.97.1(zod@3.25.76))(@modelcontextprotocol/sdk@1.29.0(zod@3.25.76))(zod@3.25.76)
12
+ specifier: 0.3.177
13
+ version: 0.3.177(@anthropic-ai/sdk@0.97.1(zod@3.25.76))(@modelcontextprotocol/sdk@1.29.0(zod@3.25.76))(zod@3.25.76)
14
14
  '@anthropic-ai/claude-code':
15
- specifier: 2.1.146
16
- version: 2.1.146
15
+ specifier: 2.1.177
16
+ version: 2.1.177
17
17
  '@modelcontextprotocol/sdk':
18
18
  specifier: 1.29.0
19
19
  version: 1.29.0(zod@3.25.76)
20
20
  ws:
21
- specifier: 8.20.1
22
- version: 8.20.1
21
+ specifier: 8.21.0
22
+ version: 8.21.0
23
23
  zod:
24
24
  specifier: 3.25.76
25
25
  version: 3.25.76
26
26
 
27
27
  packages:
28
28
 
29
- '@anthropic-ai/claude-agent-sdk-darwin-arm64@0.3.146':
30
- resolution: {integrity: sha512-0IIvlEaenq2CRSVx5Bo5BaCtHQXS87GancM35WKEYveGVLn6DI+5G7ikYuTE4AKRPkMnogFtY4BJt6LulWGj+A==}
29
+ '@anthropic-ai/claude-agent-sdk-darwin-arm64@0.3.177':
30
+ resolution: {integrity: sha512-u9Ty+KPllm2nw0RatdPF0zcPRquNZjVptmyLG0DqduGbgZDLQpfPFMF5hffFIRnVaXhx7+jkUmEdw0jrda0UcA==}
31
31
  cpu: [arm64]
32
32
  os: [darwin]
33
33
 
34
- '@anthropic-ai/claude-agent-sdk-darwin-x64@0.3.146':
35
- resolution: {integrity: sha512-Dk5xJ03Ff1JXbMRP1t2wc/TyfY6xF/2Ysp31wMhFPjoNiKSPHMWaIg242+T3CHdxLWmJ8plWHL1HL5cyZ/LCkw==}
34
+ '@anthropic-ai/claude-agent-sdk-darwin-x64@0.3.177':
35
+ resolution: {integrity: sha512-ona6Jv54XFwBTqOj3MzLWfKtc2m7Rdh58wOAX9Hnue/6FcWfyeuz/UDcidVTXQ7Xytz//Tb0JJgFtiQjO7FbIA==}
36
36
  cpu: [x64]
37
37
  os: [darwin]
38
38
 
39
- '@anthropic-ai/claude-agent-sdk-linux-arm64-musl@0.3.146':
40
- resolution: {integrity: sha512-QlCid0ucdrmhUAOewfQjaofN2wlokWcfFTxSFePTSj1umk35JO7TDFP700F7jU49r1fPWIdvJpPwWGyB0DeFPA==}
39
+ '@anthropic-ai/claude-agent-sdk-linux-arm64-musl@0.3.177':
40
+ resolution: {integrity: sha512-v6PMDD3h2erLuTK5S2ZvExqdL3v44OyC70XpKhyqIUnyPaGR9YAMjh//EKdWC+mNvt6mIbRZpaDcHtbASVW8Rw==}
41
41
  cpu: [arm64]
42
42
  os: [linux]
43
43
  libc: [musl]
44
44
 
45
- '@anthropic-ai/claude-agent-sdk-linux-arm64@0.3.146':
46
- resolution: {integrity: sha512-mzBXDDWWBAC/vDtAYpO1G/dq5QvJtYSPXsqcb+sNdcDhiuf4IYnYp7ytRncYlsUNDkLmX6Gk2jkWAHUUA2Lozg==}
45
+ '@anthropic-ai/claude-agent-sdk-linux-arm64@0.3.177':
46
+ resolution: {integrity: sha512-wBCbklkaDb483Ab4DUFfmJjZJKXz58YXPv+CiGsyjq1St19mbKEma5KKz3Ya9mlV8aLyh4zmLK2mEHPnF//Ipg==}
47
47
  cpu: [arm64]
48
48
  os: [linux]
49
49
  libc: [glibc]
50
50
 
51
- '@anthropic-ai/claude-agent-sdk-linux-x64-musl@0.3.146':
52
- resolution: {integrity: sha512-E3coK1ThQT08KIX80RLcsq7DWXFllCKOzoOe32it/bdtY56TBgPY9xemwXhIJ+cVBHTI9/MpBSIlKBcFCt+yQA==}
51
+ '@anthropic-ai/claude-agent-sdk-linux-x64-musl@0.3.177':
52
+ resolution: {integrity: sha512-1cdEO06WoEsl1JnnLCPIlg/8x37GtBsTuj65gIpSjdrImNBjgIuMWVyceP4qaXhFjtQgYK1nx3TpaxEFVDOrDg==}
53
53
  cpu: [x64]
54
54
  os: [linux]
55
55
  libc: [musl]
56
56
 
57
- '@anthropic-ai/claude-agent-sdk-linux-x64@0.3.146':
58
- resolution: {integrity: sha512-B2baXU1tCBT5CVlD7jJMKjpC4xdO45NUIWpqImmwuOfKvlM/PITjyTXyTY662mGZf1dBmdqBBsqirwFH/jhi8Q==}
57
+ '@anthropic-ai/claude-agent-sdk-linux-x64@0.3.177':
58
+ resolution: {integrity: sha512-WDP6puwPHscggNAfvIxyUSHSAjfUEkGRfnMXEPBHOqO+qjX2KGxeE13/ih3EVioeBVOUIqPui6VB05vXLa6T9Q==}
59
59
  cpu: [x64]
60
60
  os: [linux]
61
61
  libc: [glibc]
62
62
 
63
- '@anthropic-ai/claude-agent-sdk-win32-arm64@0.3.146':
64
- resolution: {integrity: sha512-CIwQxGX2r/yWpjCJ6ahB3smKXhghWgGTxL98+LGW52TUwqTiBnlNrH9DPqqgv1/+Hyquw6xfLrKU+StyfMgiLw==}
63
+ '@anthropic-ai/claude-agent-sdk-win32-arm64@0.3.177':
64
+ resolution: {integrity: sha512-xLgDWnZaYohtFrkgEIkGZdP+rp4sXxAMbbpEvEp0LK1vAYmJam/ztT2yoK6gfI58IbToJq1WGUEX2HVnE65yOg==}
65
65
  cpu: [arm64]
66
66
  os: [win32]
67
67
 
68
- '@anthropic-ai/claude-agent-sdk-win32-x64@0.3.146':
69
- resolution: {integrity: sha512-qmxrsyaqA8s4HShqJls7ZCRjdoqN66Jo/hbjQNB3uHepD8tEO1iD19aPV4+osdLT7feMkhDBfLT07Q30R2NB5w==}
68
+ '@anthropic-ai/claude-agent-sdk-win32-x64@0.3.177':
69
+ resolution: {integrity: sha512-SIdQLbtF//rYK4KDBNpUPyjyui7NwCFPZ2/3vyW3TR8R8xynkNq3cLis90FnPSgxaSshi38vkJYWh+9kGDB7zg==}
70
70
  cpu: [x64]
71
71
  os: [win32]
72
72
 
73
- '@anthropic-ai/claude-agent-sdk@0.3.146':
74
- resolution: {integrity: sha512-hK9/Ng+hOyexUemTxdIUsSWJ9o2LFi2YNWzHwz8/YMCohUYOnFMZkBiENvUAb0WIc5hieOyBZrOIlg5OewuJMg==}
73
+ '@anthropic-ai/claude-agent-sdk@0.3.177':
74
+ resolution: {integrity: sha512-CBzXnzR661q3AlfZzBjmIFQx0cxr36iJV3PExTYmPyGQX32qxtiFQgnxTcF8wB4hcSVf2hnoy/gprVJdkNx7cw==}
75
75
  engines: {node: '>=18.0.0'}
76
76
  peerDependencies:
77
77
  '@anthropic-ai/sdk': '>=0.93.0'
78
78
  '@modelcontextprotocol/sdk': ^1.29.0
79
79
  zod: ^4.0.0
80
80
 
81
- '@anthropic-ai/claude-code-darwin-arm64@2.1.146':
82
- resolution: {integrity: sha512-1xRFcJRazPa/UU8IalR+2rP9Glwylc3OFlENm1+/PmdIa604s5B1wNygkvcqhVmE8rJO65uyJXjfB3CKtq0PQA==}
81
+ '@anthropic-ai/claude-code-darwin-arm64@2.1.177':
82
+ resolution: {integrity: sha512-Fr8x9bK7tPqwdh3ThrxH8k/SNEtBbPp2nuBaeZvqboWx/WJxssYzX4aYMOSKqfPQ9CpV7AfNehF3EhVNgd3KTw==}
83
83
  cpu: [arm64]
84
84
  os: [darwin]
85
85
 
86
- '@anthropic-ai/claude-code-darwin-x64@2.1.146':
87
- resolution: {integrity: sha512-Wg34dsZG07CsdFydbPSoEaxY9KovqCxLrO/h9wpFiTMoJhlm3xWru3c4iW1cvpaed6W2kZFJSGyqeVsgZCzZ3g==}
86
+ '@anthropic-ai/claude-code-darwin-x64@2.1.177':
87
+ resolution: {integrity: sha512-5XqqrdSdMmOD88Jqla6+Y3GKoun7M1pvfTYAYTUFadvv8guqo895INf6MnUFeADOE+U6v015r4gX443xc02uGw==}
88
88
  cpu: [x64]
89
89
  os: [darwin]
90
90
 
91
- '@anthropic-ai/claude-code-linux-arm64-musl@2.1.146':
92
- resolution: {integrity: sha512-5+ZzxhNrQ9bO3XUOl2fRnZqdxFYFfTjZ5HXmxDmsKi/095u0mfNL7cRSVrWmJTLN4QFSP9EV5iWSi58n5d5CLQ==}
91
+ '@anthropic-ai/claude-code-linux-arm64-musl@2.1.177':
92
+ resolution: {integrity: sha512-cOxWAd0ROXV2RjPjaHrErzDL98Lwfix4Ury567Hm0lh00nw4okXb5WGk+Ak09hkwc2cAOmKlYRL7SAvssG9cDA==}
93
93
  cpu: [arm64]
94
94
  os: [linux]
95
95
  libc: [musl]
96
96
 
97
- '@anthropic-ai/claude-code-linux-arm64@2.1.146':
98
- resolution: {integrity: sha512-I20fmJwaT46rd5SdI117rX2ktFYA74L+ldQWmGGle3Dn4MuPQBGC+pZBcp8dlR4ydkC4HWyvyTNECu+BHpW6iQ==}
97
+ '@anthropic-ai/claude-code-linux-arm64@2.1.177':
98
+ resolution: {integrity: sha512-qb0K+/xwaZFz9spBUcDX3vNgEFTSNdbDze8AOpU4R9weVrwBY9zAO/OPqxC9qNhb5ZIRnJAZLKiICEeEUHowzA==}
99
99
  cpu: [arm64]
100
100
  os: [linux]
101
101
  libc: [glibc]
102
102
 
103
- '@anthropic-ai/claude-code-linux-x64-musl@2.1.146':
104
- resolution: {integrity: sha512-UvbhXrVUx4jmi1Sz7R+51O+91rRU7NadwLyzCOgtykXe/dVZ3kLm3D4cviyW9PqCvWRRLWHhEFPqDgdRXaAz/Q==}
103
+ '@anthropic-ai/claude-code-linux-x64-musl@2.1.177':
104
+ resolution: {integrity: sha512-sxP4VyF0mEeMtlnOBicg7fRAv8eljorpQzKEalNu5Q2kLOoOV62GO6A1dgrpVwyfMMweJjea0bBYqIMlR27mmQ==}
105
105
  cpu: [x64]
106
106
  os: [linux]
107
107
  libc: [musl]
108
108
 
109
- '@anthropic-ai/claude-code-linux-x64@2.1.146':
110
- resolution: {integrity: sha512-OL1laix9AFc/n6/vVynQQtUsMQrHJXtpQs7m1sp3na7gRqxdr9TEUSQ7ZcoCD6uuFdXZnVHf6+tI14Og/D2RLQ==}
109
+ '@anthropic-ai/claude-code-linux-x64@2.1.177':
110
+ resolution: {integrity: sha512-syChhLEXI82sld9V3QN8+IkgQy6dtScWmlMVvV2wSlG5/Zjl8UyB+ARoCcsnFCZ6dK9OzjT9TInQovrkt2ZsYw==}
111
111
  cpu: [x64]
112
112
  os: [linux]
113
113
  libc: [glibc]
114
114
 
115
- '@anthropic-ai/claude-code-win32-arm64@2.1.146':
116
- resolution: {integrity: sha512-Qouu6Efl6YwVUSJmZ0X2Hb+zLET7ppIKLWJuzyX54D6SL1SlJHeBdxFLPmLQo68NnSkbQLsUCXwsd9/nwz8mNA==}
115
+ '@anthropic-ai/claude-code-win32-arm64@2.1.177':
116
+ resolution: {integrity: sha512-5vZlPcOsDARW9gK1RNZhRUevhCop1K5wFt/SvnXX+QVWC4fMfq/Kpug1SGaRewrvZjOMfstN9jvF+TqvHuHHfQ==}
117
117
  cpu: [arm64]
118
118
  os: [win32]
119
119
 
120
- '@anthropic-ai/claude-code-win32-x64@2.1.146':
121
- resolution: {integrity: sha512-FVI6O5/XACe7+DPTzShLI7IJmkP6LrvL0O50MR97kddeMDlVB0/qSydAKjolHHzwTpOZ93l53Fgza29LpfzDvA==}
120
+ '@anthropic-ai/claude-code-win32-x64@2.1.177':
121
+ resolution: {integrity: sha512-tIAQI5OO5pA2SRQaA55CdIKXQpKkoXHZ6ll/xkTpaz+183ZnVuTCTWz6MbT6Yzyf9kwwsr3Ma1dzgZVFl/LNpw==}
122
122
  cpu: [x64]
123
123
  os: [win32]
124
124
 
125
- '@anthropic-ai/claude-code@2.1.146':
126
- resolution: {integrity: sha512-1XaW5RY1enQYlZCoAPnXI3hxchpMR3PfCozFCNHEjTZKIeevjFyBAUMYdzd35EB3fGIn89D5R7HKcztpnG0FPg==}
125
+ '@anthropic-ai/claude-code@2.1.177':
126
+ resolution: {integrity: sha512-pbBlT4O36j60k7Zd1aPQlVU1HFFpvFaTTnrsWLAVKdIHK/EcLjVjE/qY8kz9/e62XerK/UhJrZ8GsLaBNQ+6Mw==}
127
127
  engines: {node: '>=18.0.0'}
128
128
  hasBin: true
129
129
 
@@ -518,8 +518,8 @@ packages:
518
518
  wrappy@1.0.2:
519
519
  resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
520
520
 
521
- ws@8.20.1:
522
- resolution: {integrity: sha512-It4dO0K5v//JtTXuPkfEOaI3uUN87iYPnqo/ZzqCoG3g8uhA66QUMs/SrM0YK7/NAu+r4LMh/9dq2A7k+rHs+w==}
521
+ ws@8.21.0:
522
+ resolution: {integrity: sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==}
523
523
  engines: {node: '>=10.0.0'}
524
524
  peerDependencies:
525
525
  bufferutil: ^4.0.1
@@ -540,79 +540,79 @@ packages:
540
540
 
541
541
  snapshots:
542
542
 
543
- '@anthropic-ai/claude-agent-sdk-darwin-arm64@0.3.146':
543
+ '@anthropic-ai/claude-agent-sdk-darwin-arm64@0.3.177':
544
544
  optional: true
545
545
 
546
- '@anthropic-ai/claude-agent-sdk-darwin-x64@0.3.146':
546
+ '@anthropic-ai/claude-agent-sdk-darwin-x64@0.3.177':
547
547
  optional: true
548
548
 
549
- '@anthropic-ai/claude-agent-sdk-linux-arm64-musl@0.3.146':
549
+ '@anthropic-ai/claude-agent-sdk-linux-arm64-musl@0.3.177':
550
550
  optional: true
551
551
 
552
- '@anthropic-ai/claude-agent-sdk-linux-arm64@0.3.146':
552
+ '@anthropic-ai/claude-agent-sdk-linux-arm64@0.3.177':
553
553
  optional: true
554
554
 
555
- '@anthropic-ai/claude-agent-sdk-linux-x64-musl@0.3.146':
555
+ '@anthropic-ai/claude-agent-sdk-linux-x64-musl@0.3.177':
556
556
  optional: true
557
557
 
558
- '@anthropic-ai/claude-agent-sdk-linux-x64@0.3.146':
558
+ '@anthropic-ai/claude-agent-sdk-linux-x64@0.3.177':
559
559
  optional: true
560
560
 
561
- '@anthropic-ai/claude-agent-sdk-win32-arm64@0.3.146':
561
+ '@anthropic-ai/claude-agent-sdk-win32-arm64@0.3.177':
562
562
  optional: true
563
563
 
564
- '@anthropic-ai/claude-agent-sdk-win32-x64@0.3.146':
564
+ '@anthropic-ai/claude-agent-sdk-win32-x64@0.3.177':
565
565
  optional: true
566
566
 
567
- '@anthropic-ai/claude-agent-sdk@0.3.146(@anthropic-ai/sdk@0.97.1(zod@3.25.76))(@modelcontextprotocol/sdk@1.29.0(zod@3.25.76))(zod@3.25.76)':
567
+ '@anthropic-ai/claude-agent-sdk@0.3.177(@anthropic-ai/sdk@0.97.1(zod@3.25.76))(@modelcontextprotocol/sdk@1.29.0(zod@3.25.76))(zod@3.25.76)':
568
568
  dependencies:
569
569
  '@anthropic-ai/sdk': 0.97.1(zod@3.25.76)
570
570
  '@modelcontextprotocol/sdk': 1.29.0(zod@3.25.76)
571
571
  zod: 3.25.76
572
572
  optionalDependencies:
573
- '@anthropic-ai/claude-agent-sdk-darwin-arm64': 0.3.146
574
- '@anthropic-ai/claude-agent-sdk-darwin-x64': 0.3.146
575
- '@anthropic-ai/claude-agent-sdk-linux-arm64': 0.3.146
576
- '@anthropic-ai/claude-agent-sdk-linux-arm64-musl': 0.3.146
577
- '@anthropic-ai/claude-agent-sdk-linux-x64': 0.3.146
578
- '@anthropic-ai/claude-agent-sdk-linux-x64-musl': 0.3.146
579
- '@anthropic-ai/claude-agent-sdk-win32-arm64': 0.3.146
580
- '@anthropic-ai/claude-agent-sdk-win32-x64': 0.3.146
581
-
582
- '@anthropic-ai/claude-code-darwin-arm64@2.1.146':
573
+ '@anthropic-ai/claude-agent-sdk-darwin-arm64': 0.3.177
574
+ '@anthropic-ai/claude-agent-sdk-darwin-x64': 0.3.177
575
+ '@anthropic-ai/claude-agent-sdk-linux-arm64': 0.3.177
576
+ '@anthropic-ai/claude-agent-sdk-linux-arm64-musl': 0.3.177
577
+ '@anthropic-ai/claude-agent-sdk-linux-x64': 0.3.177
578
+ '@anthropic-ai/claude-agent-sdk-linux-x64-musl': 0.3.177
579
+ '@anthropic-ai/claude-agent-sdk-win32-arm64': 0.3.177
580
+ '@anthropic-ai/claude-agent-sdk-win32-x64': 0.3.177
581
+
582
+ '@anthropic-ai/claude-code-darwin-arm64@2.1.177':
583
583
  optional: true
584
584
 
585
- '@anthropic-ai/claude-code-darwin-x64@2.1.146':
585
+ '@anthropic-ai/claude-code-darwin-x64@2.1.177':
586
586
  optional: true
587
587
 
588
- '@anthropic-ai/claude-code-linux-arm64-musl@2.1.146':
588
+ '@anthropic-ai/claude-code-linux-arm64-musl@2.1.177':
589
589
  optional: true
590
590
 
591
- '@anthropic-ai/claude-code-linux-arm64@2.1.146':
591
+ '@anthropic-ai/claude-code-linux-arm64@2.1.177':
592
592
  optional: true
593
593
 
594
- '@anthropic-ai/claude-code-linux-x64-musl@2.1.146':
594
+ '@anthropic-ai/claude-code-linux-x64-musl@2.1.177':
595
595
  optional: true
596
596
 
597
- '@anthropic-ai/claude-code-linux-x64@2.1.146':
597
+ '@anthropic-ai/claude-code-linux-x64@2.1.177':
598
598
  optional: true
599
599
 
600
- '@anthropic-ai/claude-code-win32-arm64@2.1.146':
600
+ '@anthropic-ai/claude-code-win32-arm64@2.1.177':
601
601
  optional: true
602
602
 
603
- '@anthropic-ai/claude-code-win32-x64@2.1.146':
603
+ '@anthropic-ai/claude-code-win32-x64@2.1.177':
604
604
  optional: true
605
605
 
606
- '@anthropic-ai/claude-code@2.1.146':
606
+ '@anthropic-ai/claude-code@2.1.177':
607
607
  optionalDependencies:
608
- '@anthropic-ai/claude-code-darwin-arm64': 2.1.146
609
- '@anthropic-ai/claude-code-darwin-x64': 2.1.146
610
- '@anthropic-ai/claude-code-linux-arm64': 2.1.146
611
- '@anthropic-ai/claude-code-linux-arm64-musl': 2.1.146
612
- '@anthropic-ai/claude-code-linux-x64': 2.1.146
613
- '@anthropic-ai/claude-code-linux-x64-musl': 2.1.146
614
- '@anthropic-ai/claude-code-win32-arm64': 2.1.146
615
- '@anthropic-ai/claude-code-win32-x64': 2.1.146
608
+ '@anthropic-ai/claude-code-darwin-arm64': 2.1.177
609
+ '@anthropic-ai/claude-code-darwin-x64': 2.1.177
610
+ '@anthropic-ai/claude-code-linux-arm64': 2.1.177
611
+ '@anthropic-ai/claude-code-linux-arm64-musl': 2.1.177
612
+ '@anthropic-ai/claude-code-linux-x64': 2.1.177
613
+ '@anthropic-ai/claude-code-linux-x64-musl': 2.1.177
614
+ '@anthropic-ai/claude-code-win32-arm64': 2.1.177
615
+ '@anthropic-ai/claude-code-win32-x64': 2.1.177
616
616
 
617
617
  '@anthropic-ai/sdk@0.97.1(zod@3.25.76)':
618
618
  dependencies:
@@ -1026,7 +1026,7 @@ snapshots:
1026
1026
 
1027
1027
  wrappy@1.0.2: {}
1028
1028
 
1029
- ws@8.20.1: {}
1029
+ ws@8.21.0: {}
1030
1030
 
1031
1031
  zod-to-json-schema@3.25.2(zod@3.25.76):
1032
1032
  dependencies:
@@ -2,6 +2,7 @@ import { execFileSync } from 'node:child_process';
2
2
  import { readFileSync } from 'node:fs';
3
3
  import { homedir } from 'node:os';
4
4
  import { join } from 'node:path';
5
+ import { getAiGatewayAuthFromEnv } from '@ai-sdk/harness/utils';
5
6
 
6
7
  export type ClaudeCodeAuthOptions = {
7
8
  readonly anthropic?: {
@@ -22,8 +23,8 @@ export type ClaudeCodeAuthOptions = {
22
23
  * 1. Explicit `auth.anthropic` — pin to direct Anthropic auth.
23
24
  * 2. Explicit `auth.gateway` — pin to gateway-routed auth.
24
25
  * 3. Auto-detect from the host process env: gateway first
25
- * (`AI_GATEWAY_API_KEY`), then direct (`ANTHROPIC_API_KEY` /
26
- * `ANTHROPIC_AUTH_TOKEN`).
26
+ * (`AI_GATEWAY_API_KEY` / `VERCEL_OIDC_TOKEN`), then direct
27
+ * (`ANTHROPIC_API_KEY` / `ANTHROPIC_AUTH_TOKEN`).
27
28
  */
28
29
  export type ResolveClaudeCodeEnvOptions = {
29
30
  /**
@@ -45,12 +46,21 @@ export function resolveClaudeCodeEnv(
45
46
  if (auth?.anthropic) {
46
47
  return pickAnthropic({ explicit: auth.anthropic, processEnv, readApiKey });
47
48
  }
49
+
50
+ const gatewayAuthFromEnv = getAiGatewayAuthFromEnv({ env: processEnv });
48
51
  if (auth?.gateway) {
49
- return pickGateway(auth.gateway, processEnv);
52
+ return pickGateway({
53
+ explicit: auth.gateway,
54
+ gatewayAuthFromEnv,
55
+ });
50
56
  }
51
- if (processEnv.AI_GATEWAY_API_KEY) {
52
- return pickGateway({}, processEnv);
57
+ if (gatewayAuthFromEnv.apiKey) {
58
+ return pickGateway({
59
+ explicit: {},
60
+ gatewayAuthFromEnv,
61
+ });
53
62
  }
63
+
54
64
  return pickAnthropic({ processEnv, readApiKey });
55
65
  }
56
66
 
@@ -111,15 +121,15 @@ function readApiKeyHelper(): string | undefined {
111
121
  }
112
122
  }
113
123
 
114
- function pickGateway(
115
- explicit: NonNullable<ClaudeCodeAuthOptions['gateway']>,
116
- processEnv: Record<string, string | undefined>,
117
- ): Record<string, string> {
118
- const apiKey = explicit.apiKey ?? processEnv.AI_GATEWAY_API_KEY;
119
- const baseUrl =
120
- explicit.baseUrl ??
121
- processEnv.AI_GATEWAY_BASE_URL ??
122
- 'https://ai-gateway.vercel.sh';
124
+ function pickGateway({
125
+ explicit,
126
+ gatewayAuthFromEnv,
127
+ }: {
128
+ explicit: NonNullable<ClaudeCodeAuthOptions['gateway']>;
129
+ gatewayAuthFromEnv: ReturnType<typeof getAiGatewayAuthFromEnv>;
130
+ }): Record<string, string> {
131
+ const apiKey = explicit.apiKey ?? gatewayAuthFromEnv.apiKey;
132
+ const baseUrl = explicit.baseUrl ?? gatewayAuthFromEnv.baseUrl;
123
133
  const env: Record<string, string> = {};
124
134
  if (apiKey) {
125
135
  env.AI_GATEWAY_API_KEY = apiKey;
@@ -373,7 +373,7 @@ const BOOTSTRAP_DIR = '/tmp/harness/claude-code';
373
373
  * future process uses them to reopen a socket to the still-running bridge
374
374
  * (`attach`) instead of re-spawning it. Absent on a `doStop()` payload.
375
375
  */
376
- const bridgeCoordsSchema = z.object({
376
+ const claudeCodeBridgeCoordsSchema = z.object({
377
377
  port: z.number(),
378
378
  token: z.string(),
379
379
  lastSeenEventId: z.number(),
@@ -390,10 +390,10 @@ const bridgeCoordsSchema = z.object({
390
390
  * cross-process `attach`. `.passthrough()` keeps both shapes valid.
391
391
  */
392
392
  const claudeCodeResumeStateSchema = z
393
- .object({ bridge: bridgeCoordsSchema.optional() })
393
+ .object({ bridge: claudeCodeBridgeCoordsSchema.optional() })
394
394
  .passthrough();
395
395
 
396
- type ClaudeCodeBridgeCoords = z.infer<typeof bridgeCoordsSchema>;
396
+ type ClaudeCodeBridgeCoords = z.infer<typeof claudeCodeBridgeCoordsSchema>;
397
397
 
398
398
  export function createClaudeCode(
399
399
  settings: ClaudeCodeHarnessSettings = {},