@ai-sdk/harness-claude-code 1.0.0-canary.9 → 1.0.0
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/CHANGELOG.md +118 -0
- package/dist/bridge/package.json +3 -3
- package/dist/bridge/pnpm-lock.yaml +80 -80
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/bridge/package.json +3 -3
- package/src/bridge/pnpm-lock.yaml +80 -80
- package/src/claude-code-auth.ts +24 -14
- package/src/claude-code-harness.ts +3 -3
|
@@ -9,121 +9,121 @@ importers:
|
|
|
9
9
|
.:
|
|
10
10
|
dependencies:
|
|
11
11
|
'@anthropic-ai/claude-agent-sdk':
|
|
12
|
-
specifier: 0.3.
|
|
13
|
-
version: 0.3.
|
|
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.
|
|
16
|
-
version: 2.1.
|
|
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.
|
|
22
|
-
version: 8.
|
|
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.
|
|
30
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
35
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
40
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
46
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
52
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
58
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
64
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
69
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
74
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
82
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
87
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
92
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
98
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
104
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
110
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
116
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
121
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
126
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
522
|
-
resolution: {integrity: sha512-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
574
|
-
'@anthropic-ai/claude-agent-sdk-darwin-x64': 0.3.
|
|
575
|
-
'@anthropic-ai/claude-agent-sdk-linux-arm64': 0.3.
|
|
576
|
-
'@anthropic-ai/claude-agent-sdk-linux-arm64-musl': 0.3.
|
|
577
|
-
'@anthropic-ai/claude-agent-sdk-linux-x64': 0.3.
|
|
578
|
-
'@anthropic-ai/claude-agent-sdk-linux-x64-musl': 0.3.
|
|
579
|
-
'@anthropic-ai/claude-agent-sdk-win32-arm64': 0.3.
|
|
580
|
-
'@anthropic-ai/claude-agent-sdk-win32-x64': 0.3.
|
|
581
|
-
|
|
582
|
-
'@anthropic-ai/claude-code-darwin-arm64@2.1.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
603
|
+
'@anthropic-ai/claude-code-win32-x64@2.1.177':
|
|
604
604
|
optional: true
|
|
605
605
|
|
|
606
|
-
'@anthropic-ai/claude-code@2.1.
|
|
606
|
+
'@anthropic-ai/claude-code@2.1.177':
|
|
607
607
|
optionalDependencies:
|
|
608
|
-
'@anthropic-ai/claude-code-darwin-arm64': 2.1.
|
|
609
|
-
'@anthropic-ai/claude-code-darwin-x64': 2.1.
|
|
610
|
-
'@anthropic-ai/claude-code-linux-arm64': 2.1.
|
|
611
|
-
'@anthropic-ai/claude-code-linux-arm64-musl': 2.1.
|
|
612
|
-
'@anthropic-ai/claude-code-linux-x64': 2.1.
|
|
613
|
-
'@anthropic-ai/claude-code-linux-x64-musl': 2.1.
|
|
614
|
-
'@anthropic-ai/claude-code-win32-arm64': 2.1.
|
|
615
|
-
'@anthropic-ai/claude-code-win32-x64': 2.1.
|
|
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.
|
|
1029
|
+
ws@8.21.0: {}
|
|
1030
1030
|
|
|
1031
1031
|
zod-to-json-schema@3.25.2(zod@3.25.76):
|
|
1032
1032
|
dependencies:
|
package/src/claude-code-auth.ts
CHANGED
|
@@ -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
|
|
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(
|
|
52
|
+
return pickGateway({
|
|
53
|
+
explicit: auth.gateway,
|
|
54
|
+
gatewayAuthFromEnv,
|
|
55
|
+
});
|
|
50
56
|
}
|
|
51
|
-
if (
|
|
52
|
-
return pickGateway({
|
|
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
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
|
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:
|
|
393
|
+
.object({ bridge: claudeCodeBridgeCoordsSchema.optional() })
|
|
394
394
|
.passthrough();
|
|
395
395
|
|
|
396
|
-
type ClaudeCodeBridgeCoords = z.infer<typeof
|
|
396
|
+
type ClaudeCodeBridgeCoords = z.infer<typeof claudeCodeBridgeCoordsSchema>;
|
|
397
397
|
|
|
398
398
|
export function createClaudeCode(
|
|
399
399
|
settings: ClaudeCodeHarnessSettings = {},
|