Repository navigation
Commit 6a390b8
feat(provider): key provider behaviour off npm where unique
Switch the custom-loader iteration to walk merged provider entries and
resolve loaders by exact ID match or unique-npm fallback. A user-defined
provider entry with `npm: "@ai-sdk/google-vertex"` (and any other
unique-npm provider) now inherits the canonical loader's setup,
enabling multi-region Vertex AI in one session.
Migrate behavioural literal-ID checks in provider.ts, transform.ts, and
agent.ts to `model.api.npm === NPM.X` wherever the canonical loader's
npm value is unique. ID-keyed checks stay in place for the
`@ai-sdk/openai-compatible` family (7 loaders share that npm) and the
azure pair (`azure` plus `azure-cognitive-services`).
Add `packages/opencode/src/provider/npm.ts` with named constants so the
migrated equality checks live in one place and typos become compile
errors.
Fix `google-vertex-anthropic` loader to honour
`provider.options.project` and `provider.options.location` from config,
aligning it with the `google-vertex` loader (drive-by, two-line change).
Refs anomalyco#28524
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>1 parent a568f61 commit 6a390b8
5 files changed
Lines changed: 373 additions & 82 deletions
File tree
- packages/opencode
- src
- agent
- provider
- test/provider
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
399 | 400 | | |
400 | 401 | | |
401 | 402 | | |
402 | | - | |
| 403 | + | |
403 | 404 | | |
404 | 405 | | |
405 | 406 | | |
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
501 | 502 | | |
502 | 503 | | |
503 | 504 | | |
504 | | - | |
| 505 | + | |
505 | 506 | | |
506 | | - | |
507 | | - | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
508 | 512 | | |
509 | 513 | | |
510 | 514 | | |
| |||
1399 | 1403 | | |
1400 | 1404 | | |
1401 | 1405 | | |
1402 | | - | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
1403 | 1421 | | |
1404 | 1422 | | |
1405 | | - | |
1406 | | - | |
1407 | | - | |
1408 | | - | |
1409 | | - | |
1410 | | - | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
1411 | 1426 | | |
1412 | 1427 | | |
1413 | 1428 | | |
| |||
1516 | 1531 | | |
1517 | 1532 | | |
1518 | 1533 | | |
1519 | | - | |
| 1534 | + | |
1520 | 1535 | | |
1521 | 1536 | | |
1522 | 1537 | | |
| |||
1746 | 1761 | | |
1747 | 1762 | | |
1748 | 1763 | | |
| 1764 | + | |
1749 | 1765 | | |
1750 | | - | |
| 1766 | + | |
1751 | 1767 | | |
1752 | 1768 | | |
1753 | 1769 | | |
| |||
0 commit comments