Commit 484c449
authored
feat: make gcp auth work seamlessly from vscode (#1860)
Implement loading GCP oauth token via a JS callback using the gcp node
sdk, saving users from having to create a service account and put the
secret key in an env var to use the playground.
Also convert from using a DI-esque pattern where things are wired
through RuntimeContext to instead using a singleton pattern which uses
channels to mimic RPCs across the wasm/js boundary to drive the
callbacks (necessary because of the `Send` requirements that tokio
imposes on `js_sys::Value` which is not `Send`).
DONE:
- [x] - test the errors - what happens when the user is not gcloud
auth'd? is the error message good?
- [x] - restore the vertex wasm_auth path when env vars are explicitly
set
- [x] - fix this error (explicit env var should never resolve to file in
wasm) "Failed to auth - cannot load credentials from a file in WASM
(path='$INTE...', path.len=51)",
- [x] - fix this error (explicit env var should have a useful error)
"Failed to auth - cannot load credentials from a file in WASM
(path='$INTE...', path.len=51)",
- [x] - try to drop the custom result enums
- [x] - rename aws* to js-callback-bridge*
- [x] - update docs (both this and the vertex docs saying that claude is
not supported)
Fixes #1857
<!-- ELLIPSIS_HIDDEN -->
----
> [!IMPORTANT]
> Implement seamless GCP OAuth token loading from VSCode using JS
callbacks, refactor AWS credential handling, and update documentation.
>
> - **Behavior**:
> - Implement GCP OAuth token loading via JS callback using GCP Node
SDK, removing need for service account keys in env vars.
> - Refactor AWS credential handling to use JS callback bridge pattern.
> - Update `VertexAuth` in `vertex/std_auth.rs` and
`vertex/wasm_auth.rs` to support new auth strategies.
> - **JS Callback Bridge**:
> - Introduce `JsCallbackProvider` in `js_callback_provider.rs` for AWS
and GCP credential requests.
> - Implement `init_js_callback_bridge()` in `js_callback_bridge.rs` to
set up JS callbacks for credential loading.
> - **Documentation**:
> - Update `vertex.mdx` to reflect new GCP auth method and deprecate
`credentials_content`.
> - **Misc**:
> - Rename `AuthStrategy::JsonString` and `AuthStrategy::JsonFile` to
`StringContainingJson` and `MaybeFilePath` respectively.
> - Add `derive-new` dependency in `Cargo.toml` and `Cargo.lock`.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup>
for daee78a. You can
[customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>
<!-- ELLIPSIS_HIDDEN -->1 parent 8801482 commit 484c449
28 files changed
Lines changed: 815 additions & 371 deletions
File tree
- engine
- baml-lib/llm-client/src/clients
- baml-runtime
- src
- cli/serve
- internal/llm_client/primitive
- aws
- vertex
- types
- baml-schema-wasm/src
- runtime_wasm
- fern/03-reference/baml/clients/providers
- typescript
- vscode-ext/packages/vscode
- src
- panels
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
| |||
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | 27 | | |
38 | | - | |
39 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
40 | 31 | | |
41 | | - | |
| 32 | + | |
42 | 33 | | |
43 | 34 | | |
44 | 35 | | |
| |||
94 | 85 | | |
95 | 86 | | |
96 | 87 | | |
97 | | - | |
98 | | - | |
| 88 | + | |
| 89 | + | |
99 | 90 | | |
100 | 91 | | |
101 | 92 | | |
| |||
107 | 98 | | |
108 | 99 | | |
109 | 100 | | |
110 | | - | |
| 101 | + | |
111 | 102 | | |
112 | 103 | | |
113 | 104 | | |
| |||
125 | 116 | | |
126 | 117 | | |
127 | 118 | | |
128 | | - | |
129 | | - | |
| 119 | + | |
| 120 | + | |
130 | 121 | | |
131 | 122 | | |
132 | 123 | | |
133 | 124 | | |
134 | 125 | | |
135 | 126 | | |
136 | 127 | | |
137 | | - | |
| 128 | + | |
138 | 129 | | |
139 | 130 | | |
140 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
315 | | - | |
| 314 | + | |
316 | 315 | | |
317 | 316 | | |
318 | 317 | | |
| |||
400 | 399 | | |
401 | 400 | | |
402 | 401 | | |
403 | | - | |
| 402 | + | |
404 | 403 | | |
405 | 404 | | |
406 | 405 | | |
| |||
Lines changed: 3 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
310 | | - | |
311 | 310 | | |
312 | 311 | | |
313 | 312 | | |
| |||
324 | 323 | | |
325 | 324 | | |
326 | 325 | | |
327 | | - | |
328 | 326 | | |
329 | 327 | | |
330 | 328 | | |
| |||
564 | 562 | | |
565 | 563 | | |
566 | 564 | | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
| 565 | + | |
572 | 566 | | |
573 | 567 | | |
574 | 568 | | |
| |||
864 | 858 | | |
865 | 859 | | |
866 | 860 | | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
871 | | - | |
| 861 | + | |
872 | 862 | | |
873 | 863 | | |
874 | 864 | | |
| |||
Lines changed: 19 additions & 55 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | | - | |
165 | 163 | | |
166 | 164 | | |
167 | 165 | | |
| |||
176 | 174 | | |
177 | 175 | | |
178 | 176 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
230 | 182 | | |
231 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
232 | 196 | | |
233 | 197 | | |
234 | 198 | | |
| |||
Lines changed: 20 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
20 | 25 | | |
21 | 26 | | |
22 | | - | |
| 27 | + | |
23 | 28 | | |
24 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
25 | 41 | | |
26 | 42 | | |
27 | 43 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
| 33 | + | |
36 | 34 | | |
37 | 35 | | |
38 | 36 | | |
| |||
0 commit comments