Commit 53d3343
authored
feat: aws support (vscode aws sso login, options.profile) (#1493)
Fixes three issues:
- AWS_PROFILE is only supported through `aws_config::default_provider`
right now, aka when the user provides no cues about aws creds in the
baml client options
- options.profile is not respected by baml-runtime in python/ts
- options.profile is not respected by the vscode extension (aka wasm)
Some chores:
- fix unused code/imports warnings and crank those warnings up to build
errors
- rename WebPanelView to WebviewPanelHost
Implementation notes:
- vscode extensions are somewhat limited in what files they're allowed
to access through the vscode API
- technically, they're only allowed to open files available in the
repository/workspace
- although apparently the roo-code extension [doesn't have this
issue](https://github.com/RooVetGit/Roo-Code/blob/bfd50240270fe01a34d37fa9c933dc26e4330b07/src/core/Cline.ts#L964)?
seems some experimentation is required here to determine what is/isn't
allowed (but i definitely remember testing this when i implemented file
ref support for images)
- upon further investigation, this is only if you request through the
vscode API. extension sandboxing is nonexistent therefore node processes
in the extension can do whatever the heck they want.
- the baml playground (since it's a webview) currently has to request
files from vscode by RPCing through the extension
- the language server _does_ have filesystem access, so we could go
through that (i don't love the idea of pushing the aws config files and
cached credentials through the LSP stdin/stdio channel)
- better approach is to probably re-purpose the request proxy for this
(vbv's work around enabling/disabling the proxy will conflict with this,
unfortunately), and use that to bypass vscode filesystem limitations
- we need this filesystem access for the playground (this is complicated
b/c the rust->wasm code doesn't have filesystem access (since WASI is
not yet a standard): `AWS_PROFILE` can be backed by either IAM role
profiles or SSO exchanges
- IAM role profile creds are cached in `~/.aws/credentials`
- SSO profiles are stored in `~/.aws/sso/` (I'm unclear on how exactly
the Rust SDK hooks into this yet, nor if an override point exists here)
- so there's a number of files that we need to support; at a minimum we
should support aws sso, and we should also look into what other files
are needed to implement a reasonable level of support for
- alternatively: if instead of providing a shim for `std::fs::read` in
wasm, we instead just implement `ProvideCredentials` in wasm and force
it to delegate to `npm:@aws-sdk/credential-providers` in the proxy, that
feels a lot more doable. however, protocol will also need to support
forwarding env vars over (and shimming them on the node side). we may
also need some shenanigans to make sure bedrock works on promptfiddle if
we do this.
fixes #1488
<!-- ELLIPSIS_HIDDEN -->
----
> [!IMPORTANT]
> This pull request adds support for AWS profile configuration in the
BAML runtime and VSCode extension, including new commands for loading
AWS credentials and environment variables, and updates test cases to
validate these changes.
>
> - **AWS Profile Support**:
> - Added support for `options.profile` in `baml-runtime` and `vscode`
extension.
> - Implemented `LOAD_AWS_CREDS` command in `vscode-rpc.ts` to load AWS
credentials based on profile.
> - Updated `WebviewPanelHost` to handle AWS credentials loading.
> - **Environment Variables**:
> - Added `LOAD_ENV` command in `vscode-rpc.ts` to load environment
variables from `.env` file or command.
> - Implemented environment variable loading logic in
`WebviewPanelHost`.
> - **Testing**:
> - Updated `aws.test.ts` to include tests for AWS profile configuration
and invalid profile handling.
> - **Miscellaneous**:
> - Updated `package.json` and `uv.lock` to reflect new dependencies and
configurations.
> - Minor refactoring and logging improvements in `vscode` extension
files.
>
> <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 803e9f8. It will automatically
update as commits are pushed.</sup>
<!-- ELLIPSIS_HIDDEN -->1 parent 412d7f8 commit 53d3343
41 files changed
Lines changed: 1774 additions & 299 deletions
File tree
- engine
- baml-lib
- baml-log
- src
- baml-types/src
- llm-client/src/clients
- baml-runtime
- src
- cli/serve
- internal/llm_client/primitive/aws
- types
- baml-schema-wasm
- src
- runtime_wasm
- integ-tests
- baml_src
- python
- baml_client
- react/baml_client
- ruby/baml_client
- typescript
- baml_client
- tests/providers
- tools
- typescript
- playground-common
- vscode-ext/packages
- vscode
- src
- panels
- plugins/language-server
- web-panel
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
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 | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
9 | 15 | | |
10 | 16 | | |
11 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | 1 | | |
48 | 2 | | |
49 | 3 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
| |||
191 | 190 | | |
192 | 191 | | |
193 | 192 | | |
194 | | - | |
| 193 | + | |
195 | 194 | | |
196 | 195 | | |
197 | 196 | | |
| |||
215 | 214 | | |
216 | 215 | | |
217 | 216 | | |
218 | | - | |
| 217 | + | |
219 | 218 | | |
220 | 219 | | |
221 | 220 | | |
| |||
238 | 237 | | |
239 | 238 | | |
240 | 239 | | |
241 | | - | |
| 240 | + | |
242 | 241 | | |
243 | 242 | | |
244 | 243 | | |
| |||
262 | 261 | | |
263 | 262 | | |
264 | 263 | | |
265 | | - | |
| 264 | + | |
266 | 265 | | |
267 | 266 | | |
268 | 267 | | |
| |||
376 | 375 | | |
377 | 376 | | |
378 | 377 | | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
397 | 396 | | |
398 | 397 | | |
399 | 398 | | |
| |||
603 | 602 | | |
604 | 603 | | |
605 | 604 | | |
606 | | - | |
607 | | - | |
608 | | - | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
609 | 608 | | |
610 | 609 | | |
611 | 610 | | |
| |||
628 | 627 | | |
629 | 628 | | |
630 | 629 | | |
631 | | - | |
632 | | - | |
633 | | - | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
634 | 633 | | |
635 | 634 | | |
636 | 635 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
477 | 477 | | |
478 | 478 | | |
479 | 479 | | |
| 480 | + | |
480 | 481 | | |
481 | 482 | | |
482 | 483 | | |
483 | 484 | | |
484 | 485 | | |
485 | 486 | | |
486 | 487 | | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
487 | 497 | | |
488 | 498 | | |
489 | 499 | | |
| |||
0 commit comments