@namzu/bedrock 3.0.0 → 4.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 +78 -0
- package/dist/__tests__/error-taxonomy.test.js +16 -4
- package/dist/__tests__/error-taxonomy.test.js.map +1 -1
- package/dist/__tests__/model-reachability.test.d.ts +2 -0
- package/dist/__tests__/model-reachability.test.d.ts.map +1 -0
- package/dist/__tests__/model-reachability.test.js +64 -0
- package/dist/__tests__/model-reachability.test.js.map +1 -0
- package/dist/__tests__/tool-schema-dialect.test.d.ts +2 -0
- package/dist/__tests__/tool-schema-dialect.test.d.ts.map +1 -0
- package/dist/__tests__/tool-schema-dialect.test.js +98 -0
- package/dist/__tests__/tool-schema-dialect.test.js.map +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +14 -2
- package/dist/client.js.map +1 -1
- package/dist/model-reachability.d.ts +40 -0
- package/dist/model-reachability.d.ts.map +1 -0
- package/dist/model-reachability.js +72 -0
- package/dist/model-reachability.js.map +1 -0
- package/package.json +3 -3
- package/src/__tests__/error-taxonomy.test.ts +16 -4
- package/src/__tests__/model-reachability.test.ts +74 -0
- package/src/__tests__/tool-schema-dialect.test.ts +108 -0
- package/src/client.ts +18 -3
- package/src/model-reachability.ts +76 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,83 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- f8355de: tool schemas are rendered in the dialect each wire actually parses
|
|
8
|
+
|
|
9
|
+
A tool with a tuple-shaped field took down every request that offered it. The
|
|
10
|
+
kernel renders one canonical JSON Schema in draft-07, where a tuple is
|
|
11
|
+
`items: [a, b]`; one of the wires namzu speaks validates tool input as JSON
|
|
12
|
+
Schema 2020-12, where that spelling is invalid and a tuple must be
|
|
13
|
+
`prefixItems`. Every driver forwarded the rendering verbatim, so the built-in
|
|
14
|
+
`read` tool — whose `readRange` is a Zod tuple — produced a 400 that rejected
|
|
15
|
+
the **whole** request, taking every other tool in the call down with it. The
|
|
16
|
+
turn died before generating a token.
|
|
17
|
+
|
|
18
|
+
The failure had nothing to do with strict tool use, which is why the guard
|
|
19
|
+
added for the previous schema outage never saw it: it fires with strict
|
|
20
|
+
validation unset, and with strict on the dialect error arrives _first_.
|
|
21
|
+
|
|
22
|
+
Which dialect a wire parses is a property of the wire, so the conversion now
|
|
23
|
+
happens at each driver's boundary rather than in the renderer:
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { toSchemaDialect, findDraft07Only } from "@namzu/sdk";
|
|
27
|
+
|
|
28
|
+
toSchemaDialect(schema, "2020-12"); // items: [a, b] -> prefixItems: [a, b]
|
|
29
|
+
findDraft07Only(schema); // paths that no 2020-12 parser will accept
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`renderToolSchema` is exported now too, so a caller assembling its own tool
|
|
33
|
+
payload gets the same memoized, `$schema`-stripped, deep-frozen rendering the
|
|
34
|
+
kernel puts on the wire — byte-identical across iterations, which matters
|
|
35
|
+
because the tools block sits at position 0 of the prompt-cache prefix.
|
|
36
|
+
|
|
37
|
+
`ToolCatalog` used to convert schemas through its own inline call with the same
|
|
38
|
+
options. Same output, none of the guarantees: no `$schema` stripping, no
|
|
39
|
+
memoization, no freeze. It goes through `renderToolSchema` now.
|
|
40
|
+
|
|
41
|
+
**Breaking, for the three drivers.** Their `@namzu/sdk` peer range was
|
|
42
|
+
`>=1.3.0` and is now `>=6.0.0`. That range was already wrong — the drivers call
|
|
43
|
+
kernel functions added well after 1.3.0 — and it would now let a package
|
|
44
|
+
manager install a combination that throws on every request carrying a tool.
|
|
45
|
+
Upgrade the kernel alongside the driver.
|
|
46
|
+
|
|
47
|
+
The conversion follows the model on multi-vendor wires. Bedrock's Converse API
|
|
48
|
+
carries several vendors through one request shape, and the 2020-12 requirement
|
|
49
|
+
was measured on one of them, so schemas bound for the others are left in the
|
|
50
|
+
dialect they were rendered in. Guessing there would trade a known break for an
|
|
51
|
+
unmeasured one.
|
|
52
|
+
|
|
53
|
+
## 3.1.0
|
|
54
|
+
|
|
55
|
+
### Minor Changes
|
|
56
|
+
|
|
57
|
+
- 06ddb7d: Refuses a model id this driver's wire cannot serve, instead of letting AWS
|
|
58
|
+
answer with a validation error that names neither the cause nor the fix.
|
|
59
|
+
|
|
60
|
+
This driver speaks Bedrock's `Converse` API, which serves ARN-versioned model
|
|
61
|
+
ids — `us.anthropic.claude-sonnet-4-5-20250929-v1:0` and friends, the
|
|
62
|
+
integration documented for Claude 4.6 and earlier.
|
|
63
|
+
|
|
64
|
+
The current generation is not on that wire. Claude Opus 5, Sonnet 5, Fable 5,
|
|
65
|
+
Opus 4.8 and Opus 4.7 are served by a different Bedrock integration that speaks
|
|
66
|
+
the Messages API shape, and their ids carry no version suffix at all
|
|
67
|
+
(`anthropic.claude-opus-5`). The vendor's own legacy page gives the reason they
|
|
68
|
+
are absent from its model table: they have no ARN-versioned ids.
|
|
69
|
+
|
|
70
|
+
Passing one here now throws before any AWS call, naming both what this wire
|
|
71
|
+
serves and where the newer models live.
|
|
72
|
+
|
|
73
|
+
It is a check on the id SHAPE, not a model list. An unrecognised but versioned
|
|
74
|
+
id passes untouched, and non-Claude models are not policed at all — a list that
|
|
75
|
+
has to be edited for every new model is wrong before anyone reads it.
|
|
76
|
+
|
|
77
|
+
Reaching the newer models needs a driver built for that endpoint. That is not
|
|
78
|
+
in this release, and guessing at a wire is how a driver ends up confidently
|
|
79
|
+
wrong; the reachability refusal is correct and complete on its own.
|
|
80
|
+
|
|
3
81
|
## 3.0.0
|
|
4
82
|
|
|
5
83
|
### Major Changes
|
|
@@ -162,10 +162,21 @@ describe('@namzu/bedrock — provider error taxonomy', () => {
|
|
|
162
162
|
providerId: 'bedrock',
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
|
-
it('
|
|
166
|
-
|
|
165
|
+
it('keeps a validation stream event’s complaint, scrubbed, and still retains no cause', async () => {
|
|
166
|
+
// This test used to assert the opposite half: that the vendor's sentence
|
|
167
|
+
// was dropped whole. That was the safe-looking reading of "an error body
|
|
168
|
+
// can echo a credential", and it cost a day of production downtime —
|
|
169
|
+
// the wire had been naming the exact offending field the entire time and
|
|
170
|
+
// the SDK deleted the sentence before anyone could read it.
|
|
171
|
+
//
|
|
172
|
+
// So the guarantee changed shape rather than weakening: what is scrubbed
|
|
173
|
+
// is anything CREDENTIAL-SHAPED, and what survives is the complaint. The
|
|
174
|
+
// `cause` half is unchanged and still matters — a `cause` survives every
|
|
175
|
+
// logger that serializes an error chain, which is how the raw body would
|
|
176
|
+
// get out regardless of what the message says.
|
|
177
|
+
const key = 'AKIAIOSFODNN7EXAMPLE';
|
|
167
178
|
const aws = new ValidationException({
|
|
168
|
-
message: `invalid
|
|
179
|
+
message: `inputSchema is invalid, echoed from key ${key}`,
|
|
169
180
|
$metadata: { httpStatusCode: 400 },
|
|
170
181
|
});
|
|
171
182
|
const err = await captureChatStreamError(providerStreaming({ validationException: aws }));
|
|
@@ -174,7 +185,8 @@ describe('@namzu/bedrock — provider error taxonomy', () => {
|
|
|
174
185
|
kind: 'bad_request',
|
|
175
186
|
providerId: 'bedrock',
|
|
176
187
|
});
|
|
177
|
-
expect(err.message).
|
|
188
|
+
expect(err.message).toContain('inputSchema is invalid');
|
|
189
|
+
expect(err.message).not.toContain(key);
|
|
178
190
|
expect('cause' in err).toBe(false);
|
|
179
191
|
});
|
|
180
192
|
it('preserves the caller abort reason when the SDK replaces the error object', async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-taxonomy.test.js","sourceRoot":"","sources":["../../src/__tests__/error-taxonomy.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACN,qBAAqB,EACrB,mBAAmB,EACnB,6BAA6B,EAC7B,2BAA2B,EAC3B,mBAAmB,EACnB,mBAAmB,GAC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ourceRoot":"","sources":["../../src/__tests__/model-reachability.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { BedrockProvider } from '../client.js';
|
|
3
|
+
import { assertModelReachable } from '../model-reachability.js';
|
|
4
|
+
/**
|
|
5
|
+
* This driver speaks Converse with ARN-versioned model ids. The current Claude
|
|
6
|
+
* generation is served by a different Bedrock integration whose ids carry no
|
|
7
|
+
* version suffix, and pointing this wire at one produced an opaque AWS
|
|
8
|
+
* validation error naming neither the cause nor the remedy.
|
|
9
|
+
*/
|
|
10
|
+
describe('model ids this wire can serve', () => {
|
|
11
|
+
const reachable = [
|
|
12
|
+
'anthropic.claude-sonnet-4-5-20250929-v1:0',
|
|
13
|
+
'us.anthropic.claude-sonnet-4-5-20250929-v1:0',
|
|
14
|
+
'eu.anthropic.claude-opus-4-5-20251101-v1:0',
|
|
15
|
+
'global.anthropic.claude-opus-4-6-v1',
|
|
16
|
+
'apac.anthropic.claude-sonnet-4-20250514-v1:0',
|
|
17
|
+
'anthropic.claude-haiku-4-5-20251001-v1:0',
|
|
18
|
+
];
|
|
19
|
+
for (const model of reachable) {
|
|
20
|
+
it(`accepts ${model}`, () => {
|
|
21
|
+
expect(() => assertModelReachable(model)).not.toThrow();
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const unreachable = [
|
|
25
|
+
'anthropic.claude-opus-5',
|
|
26
|
+
'anthropic.claude-sonnet-5',
|
|
27
|
+
'anthropic.claude-fable-5',
|
|
28
|
+
'anthropic.claude-opus-4-8',
|
|
29
|
+
'anthropic.claude-opus-4-7',
|
|
30
|
+
'us.anthropic.claude-opus-5',
|
|
31
|
+
];
|
|
32
|
+
for (const model of unreachable) {
|
|
33
|
+
it(`refuses ${model} and says why`, () => {
|
|
34
|
+
expect(() => assertModelReachable(model)).toThrow(/cannot reach/);
|
|
35
|
+
expect(() => assertModelReachable(model)).toThrow(/Converse API/);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
it('leaves a non-Claude model alone', () => {
|
|
39
|
+
// This driver serves whatever Bedrock serves. The check is about one
|
|
40
|
+
// vendor's id scheme, not about policing the catalogue.
|
|
41
|
+
expect(() => assertModelReachable('amazon.nova-pro-v1:0')).not.toThrow();
|
|
42
|
+
expect(() => assertModelReachable('meta.llama3-70b-instruct-v1:0')).not.toThrow();
|
|
43
|
+
});
|
|
44
|
+
it('accepts an unknown versioned Claude id', () => {
|
|
45
|
+
// A model this file has never heard of passes as long as its id has
|
|
46
|
+
// the shape this wire carries. A list that must be edited for every
|
|
47
|
+
// new model is a list that is wrong before anyone reads it.
|
|
48
|
+
expect(() => assertModelReachable('anthropic.claude-sonnet-9-20991231-v1:0')).not.toThrow();
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
describe('the driver refuses before it calls AWS', () => {
|
|
52
|
+
it('throws on an unreachable model with no credentials in play', async () => {
|
|
53
|
+
const provider = new BedrockProvider({ region: 'us-east-1' });
|
|
54
|
+
await expect(async () => {
|
|
55
|
+
for await (const _ of provider.chatStream({
|
|
56
|
+
model: 'anthropic.claude-opus-5',
|
|
57
|
+
messages: [{ role: 'user', content: 'hi' }],
|
|
58
|
+
})) {
|
|
59
|
+
// drain
|
|
60
|
+
}
|
|
61
|
+
}).rejects.toThrow(/cannot reach "anthropic\.claude-opus-5"/);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=model-reachability.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-reachability.test.js","sourceRoot":"","sources":["../../src/__tests__/model-reachability.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAE/D;;;;;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wC,EAAE,GAAG,EAAE;QACjD,oEAAoE;QACpE,oEAAoE;QACpE,4DAA4D;QAC5D,MAAM,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,yCAAyC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAA;IAC5F,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,wCAAwC,EAAE,GAAG,EAAE;IACvD,EAAE,CAAC,4DAA4D,EAAE,KAAK,IAAI,EAAE;QAC3E,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,EAAE,MAAM,EAAE,WAAW,EAAW,CAAC,CAAA;QAEtE,MAAM,MAAM,CAAC,KAAK,IAAI,EAAE;YACvB,IAAI,KAAK,EAAE,MAAM,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC;gBACzC,KAAK,EAAE,yBAAyB;gBAChC,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;aACnB,CAAC,EAAE,CAAC;gBAC5B,QAAQ;YACT,CAAC;QACF,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,yCAAyC,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-schema-dialect.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/tool-schema-dialect.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { findDraft07Only } from '@namzu/sdk';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { toBedrockToolConfig } from '../client.js';
|
|
4
|
+
/**
|
|
5
|
+
* Converse carries Claude, so it carries Claude's schema dialect too.
|
|
6
|
+
*
|
|
7
|
+
* The kernel renders tool schemas as draft-07, where a tuple is
|
|
8
|
+
* `items: [a, b]`. Anthropic's serving layer validates `input_schema` as JSON
|
|
9
|
+
* Schema 2020-12, where that spelling is invalid — the tuple has to be
|
|
10
|
+
* `prefixItems` — and it rejects the whole request rather than ignoring the
|
|
11
|
+
* field, so one tuple-shaped tool takes down every tool in the call.
|
|
12
|
+
*
|
|
13
|
+
* That fix landed on the direct Anthropic driver and on the HTTP driver's
|
|
14
|
+
* Anthropic branch, and this driver was missed. It reaches the same models
|
|
15
|
+
* through a different front door; the validation happens in the same place.
|
|
16
|
+
*
|
|
17
|
+
* The conversion follows the MODEL, not the endpoint, because Converse is
|
|
18
|
+
* multi-vendor: `meta.llama*` and `mistral.*` come through this same function,
|
|
19
|
+
* and nothing establishes that they read 2020-12. Converting their schemas
|
|
20
|
+
* would be trading a known break for an unmeasured one.
|
|
21
|
+
*/
|
|
22
|
+
const TUPLE_TOOL = [
|
|
23
|
+
{
|
|
24
|
+
type: 'function',
|
|
25
|
+
function: {
|
|
26
|
+
name: 'read',
|
|
27
|
+
description: 'reads',
|
|
28
|
+
parameters: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
properties: {
|
|
31
|
+
// What `z.tuple([z.number(), z.number()])` renders to.
|
|
32
|
+
readRange: {
|
|
33
|
+
type: 'array',
|
|
34
|
+
items: [{ type: 'number' }, { type: 'number' }],
|
|
35
|
+
minItems: 2,
|
|
36
|
+
maxItems: 2,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
function rangeOf(model) {
|
|
44
|
+
const config = toBedrockToolConfig({ model, messages: [], tools: TUPLE_TOOL });
|
|
45
|
+
const json = config?.tools?.[0]?.toolSpec?.inputSchema?.json;
|
|
46
|
+
const properties = json.properties;
|
|
47
|
+
return properties.readRange;
|
|
48
|
+
}
|
|
49
|
+
function schemaOf(model) {
|
|
50
|
+
const config = toBedrockToolConfig({ model, messages: [], tools: TUPLE_TOOL });
|
|
51
|
+
return config?.tools?.[0]?.toolSpec?.inputSchema?.json;
|
|
52
|
+
}
|
|
53
|
+
describe('a tuple reaches Claude on Converse in the dialect Claude reads', () => {
|
|
54
|
+
it.each([
|
|
55
|
+
['anthropic.claude-sonnet-4-20250514', 'a bare vendor id'],
|
|
56
|
+
['us.anthropic.claude-sonnet-4-5-20250929-v1:0', 'behind an inference profile'],
|
|
57
|
+
['EU.Anthropic.Claude-Opus-4-1-v1:0', 'in whatever case the caller wrote'],
|
|
58
|
+
])('converts for %s (%s)', (model) => {
|
|
59
|
+
expect(findDraft07Only(schemaOf(model))).toEqual([]);
|
|
60
|
+
const range = rangeOf(model);
|
|
61
|
+
expect(range.prefixItems).toHaveLength(2);
|
|
62
|
+
expect(range.items).toBeUndefined();
|
|
63
|
+
});
|
|
64
|
+
it('leaves another vendor on this wire alone', () => {
|
|
65
|
+
// Not timidity — the absence of a measurement. Anthropic's requirement
|
|
66
|
+
// was measured against its own wire; no such reading exists for these,
|
|
67
|
+
// and converting on a guess swaps a known break for an unknown one.
|
|
68
|
+
const range = rangeOf('meta.llama3-70b-instruct-v1:0');
|
|
69
|
+
expect(range.items).toHaveLength(2);
|
|
70
|
+
expect(range.prefixItems).toBeUndefined();
|
|
71
|
+
});
|
|
72
|
+
it('does not disturb a schema with no tuple in it', () => {
|
|
73
|
+
const config = toBedrockToolConfig({
|
|
74
|
+
model: 'anthropic.claude-sonnet-4-20250514',
|
|
75
|
+
messages: [],
|
|
76
|
+
tools: [
|
|
77
|
+
{
|
|
78
|
+
type: 'function',
|
|
79
|
+
function: {
|
|
80
|
+
name: 'ls',
|
|
81
|
+
description: 'lists',
|
|
82
|
+
parameters: {
|
|
83
|
+
type: 'object',
|
|
84
|
+
properties: { path: { type: 'string' } },
|
|
85
|
+
required: ['path'],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
});
|
|
91
|
+
expect(config?.tools?.[0]?.toolSpec?.inputSchema?.json).toEqual({
|
|
92
|
+
type: 'object',
|
|
93
|
+
properties: { path: { type: 'string' } },
|
|
94
|
+
required: ['path'],
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=tool-schema-dialect.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-schema-dialect.test.js","sourceRoot":"","sources":["../../src/__tests__/tool-schema-dialect.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAElD;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,UAAU,GAAG;IAClB;QACC,IAAI,EAAE,UAAmB;QACzB,QAAQ,EAAE;YACT,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,OAAO;YACpB,UAAU,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACX,uDAAuD;oBACvD,SAAS,EAAE;wBACV,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;wBAC/C,QAAQ,EAAE,CAAC;wBACX,QAAQ,EAAE,CAAC;qBACX;iBACD;aACD;SACD;KACD;CACD,CAAA;AAED,SAAS,OAAO,CAAC,KAAa;IAC7B,MAAM,MAAM,GAAG,mBAAmB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;IAC9E,MAAM,IAAI,GAAG,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,IAA+B,CAAA;IACvF,MAAM,UAAU,GAAG,IAAI,CAAC,UAAqD,CAAA;IAC7E,OAAO,UAAU,CAAC,SAAoC,CAAA;AACvD,CA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G,mBAAmB,CAAC;YAClC,KAAK,EAAE,oCAAoC;YAC3C,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE;gBACN;oBACC,IAAI,EAAE,UAAU;oBAChB,QAAQ,EAAE;wBACT,IAAI,EAAE,IAAI;wBACV,WAAW,EAAE,OAAO;wBACpB,UAAU,EAAE;4BACX,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;4BACxC,QAAQ,EAAE,CAAC,MAAM,CAAC;yBAClB;qBACD;iBACD;aACD;SACD,CAAC,CAAA;QAEF,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC;YAC/D,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;YACxC,QAAQ,EAAE,CAAC,MAAM,CAAC;SAClB,CAAC,CAAA;IACH,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACX,OAAO,IAAI,cAAc,EAOzB,iBAAiB,EAEjB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EACX,oBAAoB,EAEpB,WAAW,EACX,SAAS,EACT,oBAAoB,EACpB,WAAW,EACX,UAAU,EAEV,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACX,OAAO,IAAI,cAAc,EAOzB,iBAAiB,EAEjB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EACX,oBAAoB,EAEpB,WAAW,EACX,SAAS,EACT,oBAAoB,EACpB,WAAW,EACX,UAAU,EAEV,MAAM,YAAY,CAAA;AAUnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAY/C,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,UAAU,CAAC,GAAG,cAAc,EAAE,CAgE9F;AA6BD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,oBAAoB,GAAG,iBAAiB,GAAG,SAAS,CAoD/F;AAYD,UAAU,eAAe;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,yBAAyB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED,wBAAgB,iBAAiB,CAAC,GAAG,CAAC,EAAE,eAAe,GAAG,UAAU,CAmBnE;AAoBD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,EAAE,oBAOlC,CAAA;AAED,qBAAa,eAAgB,YAAW,WAAW;IAClD,QAAQ,CAAC,EAAE,aAAY;IACvB,QAAQ,CAAC,IAAI,iBAAgB;IAC7B,QAAQ,CAAC,YAAY,uBAAuB;IAE5C,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,EAAE,aAAa;IAoB1B,UAAU,CAAC,MAAM,EAAE,oBAAoB,GAAG,aAAa,CAAC,WAAW,CAAC;IAuKrE,UAAU,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAmClC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAerC"}
|
package/dist/client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BedrockRuntimeClient, ConverseCommand, ConverseStreamCommand, } from '@aws-sdk/client-bedrock-runtime';
|
|
2
|
-
import { assertThinkingUnsupported, toolResultToText } from '@namzu/sdk';
|
|
2
|
+
import { assertThinkingUnsupported, toSchemaDialect, toolResultToText } from '@namzu/sdk';
|
|
3
3
|
import { ProviderRequestError, isCallerAbortError, isProviderRequestError, providerVendorError, } from '@namzu/sdk';
|
|
4
|
+
import { assertModelReachable, isAnthropicServedModel } from './model-reachability.js';
|
|
4
5
|
function extractSystemBlocks(messages) {
|
|
5
6
|
return messages
|
|
6
7
|
.filter((m) => m.role === 'system')
|
|
@@ -97,12 +98,19 @@ export function toBedrockToolConfig(params) {
|
|
|
97
98
|
if (params.toolChoice === 'none')
|
|
98
99
|
return undefined;
|
|
99
100
|
if (params.tools && params.tools.length > 0) {
|
|
101
|
+
// Claude reached through Converse is still Claude: its serving layer
|
|
102
|
+
// validates `inputSchema.json` as JSON Schema 2020-12, so a tuple
|
|
103
|
+
// rendered in draft-07's `items: [a, b]` spelling fails here for the
|
|
104
|
+
// same reason it fails on the direct wire. Converse carries other
|
|
105
|
+
// vendors too, and nothing says they read 2020-12, so the conversion
|
|
106
|
+
// follows the model rather than the endpoint.
|
|
107
|
+
const dialect = isAnthropicServedModel(params.model) ? '2020-12' : 'draft-07';
|
|
100
108
|
const tools = params.tools.map((t) => ({
|
|
101
109
|
toolSpec: {
|
|
102
110
|
name: t.function.name,
|
|
103
111
|
description: t.function.description ?? '',
|
|
104
112
|
inputSchema: {
|
|
105
|
-
json: (t.function.parameters ?? {}),
|
|
113
|
+
json: toSchemaDialect((t.function.parameters ?? {}), dialect),
|
|
106
114
|
},
|
|
107
115
|
},
|
|
108
116
|
}));
|
|
@@ -207,6 +215,10 @@ export class BedrockProvider {
|
|
|
207
215
|
}
|
|
208
216
|
async *chatStream(params) {
|
|
209
217
|
assertThinkingUnsupported('BedrockProvider', params);
|
|
218
|
+
// Before any AWS call: an unreachable model id fails here with the
|
|
219
|
+
// reason and the fix, rather than as an opaque validation error from
|
|
220
|
+
// a service that was asked for something this wire does not carry.
|
|
221
|
+
assertModelReachable(params.model);
|
|
210
222
|
const system = extractSystemBlocks(params.messages);
|
|
211
223
|
const messages = toBedrockMessages(params.messages);
|
|
212
224
|
const toolConfig = toBedrockToolConfig(params);
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,eAAe,EACf,qBAAqB,GACrB,MAAM,iCAAiC,CAAA;AAuBxC,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACxE,OAAO,EACN,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,YAAY,CAAA;AAGnB,SAAS,mBAAmB,CAAC,QAA0C;IACtE,OAAO,QAAQ;SACb,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;SAClC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AACzE,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IAClC,OAAO,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAA;AACnD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAA0C;IAC3E,MAAM,GAAG,GAAqB,EAAE,CAAA;IAEhC,IAAI,kBAAkB,GAAmB,EAAE,CAAA;IAE3C,MAAM,gBAAgB,GAAG,GAAG,EAAE;QAC7B,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAA;YACvD,kBAAkB,GAAG,EAAE,CAAA;QACxB,C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`Converse` / `ConverseStream` with ARN-versioned model
|
|
5
|
+
* ids — `anthropic.claude-sonnet-4-5-20250929-v1:0`, usually behind an
|
|
6
|
+
* inference-profile prefix (`us.`, `eu.`, `global.`). That is the integration
|
|
7
|
+
* documented for Claude 4.6 and earlier.
|
|
8
|
+
*
|
|
9
|
+
* The current generation is not on it. Claude Opus 5, Sonnet 5, Fable 5, Opus
|
|
10
|
+
* 4.8 and Opus 4.7 are served by a different Bedrock integration that speaks
|
|
11
|
+
* the Messages API shape, and their ids carry no version suffix at all
|
|
12
|
+
* (`anthropic.claude-opus-5`). The vendor's own legacy page states the reason
|
|
13
|
+
* they are absent from its model table: they do not have ARN-versioned model
|
|
14
|
+
* ids.
|
|
15
|
+
*
|
|
16
|
+
* So a caller passing a 5-series id here is not making a small mistake that a
|
|
17
|
+
* shrug would absorb — they are pointing a wire at models it was not built
|
|
18
|
+
* for, and the answer they get back is an opaque AWS validation error naming
|
|
19
|
+
* neither the cause nor the fix. Refusing with both is the whole value of
|
|
20
|
+
* knowing this.
|
|
21
|
+
*
|
|
22
|
+
* **This is a reachability check, not a capability table.** It does not claim
|
|
23
|
+
* to know which models exist, only which id SHAPE this wire accepts. A new
|
|
24
|
+
* ARN-versioned model passes without this file changing, which is the correct
|
|
25
|
+
* failure direction for a list that will go stale.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Whether this id names a model Anthropic serves.
|
|
29
|
+
*
|
|
30
|
+
* Converse is a multi-vendor wire — the same request shape carries Claude,
|
|
31
|
+
* Llama, Mistral and more — so a property of the Anthropic models is not a
|
|
32
|
+
* property of the wire. Tool input schemas are one: Anthropic's serving layer
|
|
33
|
+
* validates them against JSON Schema 2020-12 regardless of which front door the
|
|
34
|
+
* request came through, while nothing says the other vendors on this wire do.
|
|
35
|
+
* Rendering the dialect Anthropic requires, only for the models that require
|
|
36
|
+
* it, is the claim that can actually be defended.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isAnthropicServedModel(modelId: string): boolean;
|
|
39
|
+
export declare function assertModelReachable(modelId: string): void;
|
|
40
|
+
//# sourceMappingURL=model-reachability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-reachability.d.ts","sourceRoot":"","sources":["../src/model-reachability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AA0BH;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAS1D"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this driver's wire can serve a given model id.
|
|
3
|
+
*
|
|
4
|
+
* This driver speaks `Converse` / `ConverseStream` with ARN-versioned model
|
|
5
|
+
* ids — `anthropic.claude-sonnet-4-5-20250929-v1:0`, usually behind an
|
|
6
|
+
* inference-profile prefix (`us.`, `eu.`, `global.`). That is the integration
|
|
7
|
+
* documented for Claude 4.6 and earlier.
|
|
8
|
+
*
|
|
9
|
+
* The current generation is not on it. Claude Opus 5, Sonnet 5, Fable 5, Opus
|
|
10
|
+
* 4.8 and Opus 4.7 are served by a different Bedrock integration that speaks
|
|
11
|
+
* the Messages API shape, and their ids carry no version suffix at all
|
|
12
|
+
* (`anthropic.claude-opus-5`). The vendor's own legacy page states the reason
|
|
13
|
+
* they are absent from its model table: they do not have ARN-versioned model
|
|
14
|
+
* ids.
|
|
15
|
+
*
|
|
16
|
+
* So a caller passing a 5-series id here is not making a small mistake that a
|
|
17
|
+
* shrug would absorb — they are pointing a wire at models it was not built
|
|
18
|
+
* for, and the answer they get back is an opaque AWS validation error naming
|
|
19
|
+
* neither the cause nor the fix. Refusing with both is the whole value of
|
|
20
|
+
* knowing this.
|
|
21
|
+
*
|
|
22
|
+
* **This is a reachability check, not a capability table.** It does not claim
|
|
23
|
+
* to know which models exist, only which id SHAPE this wire accepts. A new
|
|
24
|
+
* ARN-versioned model passes without this file changing, which is the correct
|
|
25
|
+
* failure direction for a list that will go stale.
|
|
26
|
+
*/
|
|
27
|
+
/** Inference-profile prefixes the Converse wire accepts on a model id. */
|
|
28
|
+
const PROFILE_PREFIXES = ['global.', 'us.', 'eu.', 'jp.', 'apac.'];
|
|
29
|
+
function stripProfilePrefix(modelId) {
|
|
30
|
+
for (const prefix of PROFILE_PREFIXES) {
|
|
31
|
+
if (modelId.startsWith(prefix))
|
|
32
|
+
return modelId.slice(prefix.length);
|
|
33
|
+
}
|
|
34
|
+
return modelId;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A Claude id with no ARN version suffix — the shape the newer Bedrock
|
|
38
|
+
* integration uses, and the one this wire cannot serve.
|
|
39
|
+
*
|
|
40
|
+
* Matched positively rather than by excluding known-good names: the set of
|
|
41
|
+
* versioned models grows, and a check that has to be edited for every new
|
|
42
|
+
* model is a check that will be wrong before it is read.
|
|
43
|
+
*/
|
|
44
|
+
const UNVERSIONED_CLAUDE = /^anthropic\.claude-(?:haiku|sonnet|opus|fable|mythos)-[a-z0-9.-]*$/;
|
|
45
|
+
function hasArnVersion(modelId) {
|
|
46
|
+
return /-v\d+(?::\d+)?$/.test(modelId);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Whether this id names a model Anthropic serves.
|
|
50
|
+
*
|
|
51
|
+
* Converse is a multi-vendor wire — the same request shape carries Claude,
|
|
52
|
+
* Llama, Mistral and more — so a property of the Anthropic models is not a
|
|
53
|
+
* property of the wire. Tool input schemas are one: Anthropic's serving layer
|
|
54
|
+
* validates them against JSON Schema 2020-12 regardless of which front door the
|
|
55
|
+
* request came through, while nothing says the other vendors on this wire do.
|
|
56
|
+
* Rendering the dialect Anthropic requires, only for the models that require
|
|
57
|
+
* it, is the claim that can actually be defended.
|
|
58
|
+
*/
|
|
59
|
+
export function isAnthropicServedModel(modelId) {
|
|
60
|
+
return stripProfilePrefix(modelId.trim().toLowerCase()).startsWith('anthropic.');
|
|
61
|
+
}
|
|
62
|
+
export function assertModelReachable(modelId) {
|
|
63
|
+
const bare = stripProfilePrefix(modelId.trim().toLowerCase());
|
|
64
|
+
if (!bare.startsWith('anthropic.'))
|
|
65
|
+
return;
|
|
66
|
+
if (hasArnVersion(bare))
|
|
67
|
+
return;
|
|
68
|
+
if (!UNVERSIONED_CLAUDE.test(bare))
|
|
69
|
+
return;
|
|
70
|
+
throw new Error(`This driver cannot reach "${modelId}". It speaks Bedrock's Converse API, which serves ARN-versioned model ids such as "us.anthropic.claude-sonnet-4-5-20250929-v1:0" — Claude 4.6 and earlier. Models with no version suffix (Opus 5, Sonnet 5, Fable 5, Opus 4.8, Opus 4.7) are served by the newer Bedrock integration, which speaks the Messages API shape at a different endpoint and is not what this driver talks to. Use a versioned model id here, or reach the newer models through a driver built for that endpoint.`);
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=model-reachability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-reachability.js","sourceRoot":"","sources":["../src/model-reachability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,0EAA0E;AAC1E,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AAElE,SAAS,kBAAkB,CAAC,OAAe;IAC1C,KAAK,MAAM,MAAM,IAAI,gBAAgB,EAAE,CAAC;QACvC,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACpE,CAAC;IACD,OAAO,OAAO,CAAA;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,kBAAkB,GAAG,oEAAoE,CAAA;AAE/F,SAAS,aAAa,CAAC,OAAe;IACrC,OAAO,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACvC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAe;IACrD,OAAO,kBAAkB,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAA;AACjF,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,OAAe;IACnD,MAAM,IAAI,GAAG,kBAAkB,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;IAC7D,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;QAAE,OAAM;IAC1C,IAAI,aAAa,CAAC,IAAI,CAAC;QAAE,OAAM;IAC/B,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAM;IAE1C,MAAM,IAAI,KAAK,CACd,6BAA6B,OAAO,4dAA4d,CAChgB,CAAA;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@namzu/bedrock",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "AWS Bedrock LLM provider for @namzu/sdk. Provides Converse API (chat + streaming) with full tool-use support.",
|
|
5
5
|
"license": "FSL-1.1-MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
"@aws-sdk/client-bedrock-runtime": "^3.1101.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@namzu/sdk": ">=
|
|
40
|
+
"@namzu/sdk": ">=6.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@biomejs/biome": "^1.9.4",
|
|
44
44
|
"@types/node": "^22.19.17",
|
|
45
45
|
"typescript": "^5.5.0",
|
|
46
46
|
"vitest": "^3.2.6",
|
|
47
|
-
"@namzu/sdk": "^
|
|
47
|
+
"@namzu/sdk": "^6.0.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsc --build",
|
|
@@ -202,10 +202,21 @@ describe('@namzu/bedrock — provider error taxonomy', () => {
|
|
|
202
202
|
})
|
|
203
203
|
})
|
|
204
204
|
|
|
205
|
-
it('
|
|
206
|
-
|
|
205
|
+
it('keeps a validation stream event’s complaint, scrubbed, and still retains no cause', async () => {
|
|
206
|
+
// This test used to assert the opposite half: that the vendor's sentence
|
|
207
|
+
// was dropped whole. That was the safe-looking reading of "an error body
|
|
208
|
+
// can echo a credential", and it cost a day of production downtime —
|
|
209
|
+
// the wire had been naming the exact offending field the entire time and
|
|
210
|
+
// the SDK deleted the sentence before anyone could read it.
|
|
211
|
+
//
|
|
212
|
+
// So the guarantee changed shape rather than weakening: what is scrubbed
|
|
213
|
+
// is anything CREDENTIAL-SHAPED, and what survives is the complaint. The
|
|
214
|
+
// `cause` half is unchanged and still matters — a `cause` survives every
|
|
215
|
+
// logger that serializes an error chain, which is how the raw body would
|
|
216
|
+
// get out regardless of what the message says.
|
|
217
|
+
const key = 'AKIAIOSFODNN7EXAMPLE'
|
|
207
218
|
const aws = new ValidationException({
|
|
208
|
-
message: `invalid
|
|
219
|
+
message: `inputSchema is invalid, echoed from key ${key}`,
|
|
209
220
|
$metadata: { httpStatusCode: 400 },
|
|
210
221
|
})
|
|
211
222
|
|
|
@@ -216,7 +227,8 @@ describe('@namzu/bedrock — provider error taxonomy', () => {
|
|
|
216
227
|
kind: 'bad_request',
|
|
217
228
|
providerId: 'bedrock',
|
|
218
229
|
})
|
|
219
|
-
expect((err as Error).message).
|
|
230
|
+
expect((err as Error).message).toContain('inputSchema is invalid')
|
|
231
|
+
expect((err as Error).message).not.toContain(key)
|
|
220
232
|
expect('cause' in (err as object)).toBe(false)
|
|
221
233
|
})
|
|
222
234
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { ChatCompletionParams } from '@namzu/sdk'
|
|
2
|
+
import { describe, expect, it } from 'vitest'
|
|
3
|
+
|
|
4
|
+
import { BedrockProvider } from '../client.js'
|
|
5
|
+
import { assertModelReachable } from '../model-reachability.js'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* This driver speaks Converse with ARN-versioned model ids. The current Claude
|
|
9
|
+
* generation is served by a different Bedrock integration whose ids carry no
|
|
10
|
+
* version suffix, and pointing this wire at one produced an opaque AWS
|
|
11
|
+
* validation error naming neither the cause nor the remedy.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
describe('model ids this wire can serve', () => {
|
|
15
|
+
const reachable = [
|
|
16
|
+
'anthropic.claude-sonnet-4-5-20250929-v1:0',
|
|
17
|
+
'us.anthropic.claude-sonnet-4-5-20250929-v1:0',
|
|
18
|
+
'eu.anthropic.claude-opus-4-5-20251101-v1:0',
|
|
19
|
+
'global.anthropic.claude-opus-4-6-v1',
|
|
20
|
+
'apac.anthropic.claude-sonnet-4-20250514-v1:0',
|
|
21
|
+
'anthropic.claude-haiku-4-5-20251001-v1:0',
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
for (const model of reachable) {
|
|
25
|
+
it(`accepts ${model}`, () => {
|
|
26
|
+
expect(() => assertModelReachable(model)).not.toThrow()
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const unreachable = [
|
|
31
|
+
'anthropic.claude-opus-5',
|
|
32
|
+
'anthropic.claude-sonnet-5',
|
|
33
|
+
'anthropic.claude-fable-5',
|
|
34
|
+
'anthropic.claude-opus-4-8',
|
|
35
|
+
'anthropic.claude-opus-4-7',
|
|
36
|
+
'us.anthropic.claude-opus-5',
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
for (const model of unreachable) {
|
|
40
|
+
it(`refuses ${model} and says why`, () => {
|
|
41
|
+
expect(() => assertModelReachable(model)).toThrow(/cannot reach/)
|
|
42
|
+
expect(() => assertModelReachable(model)).toThrow(/Converse API/)
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
it('leaves a non-Claude model alone', () => {
|
|
47
|
+
// This driver serves whatever Bedrock serves. The check is about one
|
|
48
|
+
// vendor's id scheme, not about policing the catalogue.
|
|
49
|
+
expect(() => assertModelReachable('amazon.nova-pro-v1:0')).not.toThrow()
|
|
50
|
+
expect(() => assertModelReachable('meta.llama3-70b-instruct-v1:0')).not.toThrow()
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('accepts an unknown versioned Claude id', () => {
|
|
54
|
+
// A model this file has never heard of passes as long as its id has
|
|
55
|
+
// the shape this wire carries. A list that must be edited for every
|
|
56
|
+
// new model is a list that is wrong before anyone reads it.
|
|
57
|
+
expect(() => assertModelReachable('anthropic.claude-sonnet-9-20991231-v1:0')).not.toThrow()
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
describe('the driver refuses before it calls AWS', () => {
|
|
62
|
+
it('throws on an unreachable model with no credentials in play', async () => {
|
|
63
|
+
const provider = new BedrockProvider({ region: 'us-east-1' } as never)
|
|
64
|
+
|
|
65
|
+
await expect(async () => {
|
|
66
|
+
for await (const _ of provider.chatStream({
|
|
67
|
+
model: 'anthropic.claude-opus-5',
|
|
68
|
+
messages: [{ role: 'user', content: 'hi' }],
|
|
69
|
+
} as ChatCompletionParams)) {
|
|
70
|
+
// drain
|
|
71
|
+
}
|
|
72
|
+
}).rejects.toThrow(/cannot reach "anthropic\.claude-opus-5"/)
|
|
73
|
+
})
|
|
74
|
+
})
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { findDraft07Only } from '@namzu/sdk'
|
|
2
|
+
import { describe, expect, it } from 'vitest'
|
|
3
|
+
|
|
4
|
+
import { toBedrockToolConfig } from '../client.js'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Converse carries Claude, so it carries Claude's schema dialect too.
|
|
8
|
+
*
|
|
9
|
+
* The kernel renders tool schemas as draft-07, where a tuple is
|
|
10
|
+
* `items: [a, b]`. Anthropic's serving layer validates `input_schema` as JSON
|
|
11
|
+
* Schema 2020-12, where that spelling is invalid — the tuple has to be
|
|
12
|
+
* `prefixItems` — and it rejects the whole request rather than ignoring the
|
|
13
|
+
* field, so one tuple-shaped tool takes down every tool in the call.
|
|
14
|
+
*
|
|
15
|
+
* That fix landed on the direct Anthropic driver and on the HTTP driver's
|
|
16
|
+
* Anthropic branch, and this driver was missed. It reaches the same models
|
|
17
|
+
* through a different front door; the validation happens in the same place.
|
|
18
|
+
*
|
|
19
|
+
* The conversion follows the MODEL, not the endpoint, because Converse is
|
|
20
|
+
* multi-vendor: `meta.llama*` and `mistral.*` come through this same function,
|
|
21
|
+
* and nothing establishes that they read 2020-12. Converting their schemas
|
|
22
|
+
* would be trading a known break for an unmeasured one.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const TUPLE_TOOL = [
|
|
26
|
+
{
|
|
27
|
+
type: 'function' as const,
|
|
28
|
+
function: {
|
|
29
|
+
name: 'read',
|
|
30
|
+
description: 'reads',
|
|
31
|
+
parameters: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
// What `z.tuple([z.number(), z.number()])` renders to.
|
|
35
|
+
readRange: {
|
|
36
|
+
type: 'array',
|
|
37
|
+
items: [{ type: 'number' }, { type: 'number' }],
|
|
38
|
+
minItems: 2,
|
|
39
|
+
maxItems: 2,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
function rangeOf(model: string): Record<string, unknown> {
|
|
48
|
+
const config = toBedrockToolConfig({ model, messages: [], tools: TUPLE_TOOL })
|
|
49
|
+
const json = config?.tools?.[0]?.toolSpec?.inputSchema?.json as Record<string, unknown>
|
|
50
|
+
const properties = json.properties as Record<string, Record<string, unknown>>
|
|
51
|
+
return properties.readRange as Record<string, unknown>
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function schemaOf(model: string): Record<string, unknown> {
|
|
55
|
+
const config = toBedrockToolConfig({ model, messages: [], tools: TUPLE_TOOL })
|
|
56
|
+
return config?.tools?.[0]?.toolSpec?.inputSchema?.json as Record<string, unknown>
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
describe('a tuple reaches Claude on Converse in the dialect Claude reads', () => {
|
|
60
|
+
it.each([
|
|
61
|
+
['anthropic.claude-sonnet-4-20250514', 'a bare vendor id'],
|
|
62
|
+
['us.anthropic.claude-sonnet-4-5-20250929-v1:0', 'behind an inference profile'],
|
|
63
|
+
['EU.Anthropic.Claude-Opus-4-1-v1:0', 'in whatever case the caller wrote'],
|
|
64
|
+
])('converts for %s (%s)', (model) => {
|
|
65
|
+
expect(findDraft07Only(schemaOf(model))).toEqual([])
|
|
66
|
+
|
|
67
|
+
const range = rangeOf(model)
|
|
68
|
+
expect(range.prefixItems).toHaveLength(2)
|
|
69
|
+
expect(range.items).toBeUndefined()
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
it('leaves another vendor on this wire alone', () => {
|
|
73
|
+
// Not timidity — the absence of a measurement. Anthropic's requirement
|
|
74
|
+
// was measured against its own wire; no such reading exists for these,
|
|
75
|
+
// and converting on a guess swaps a known break for an unknown one.
|
|
76
|
+
const range = rangeOf('meta.llama3-70b-instruct-v1:0')
|
|
77
|
+
|
|
78
|
+
expect(range.items).toHaveLength(2)
|
|
79
|
+
expect(range.prefixItems).toBeUndefined()
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('does not disturb a schema with no tuple in it', () => {
|
|
83
|
+
const config = toBedrockToolConfig({
|
|
84
|
+
model: 'anthropic.claude-sonnet-4-20250514',
|
|
85
|
+
messages: [],
|
|
86
|
+
tools: [
|
|
87
|
+
{
|
|
88
|
+
type: 'function',
|
|
89
|
+
function: {
|
|
90
|
+
name: 'ls',
|
|
91
|
+
description: 'lists',
|
|
92
|
+
parameters: {
|
|
93
|
+
type: 'object',
|
|
94
|
+
properties: { path: { type: 'string' } },
|
|
95
|
+
required: ['path'],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
expect(config?.tools?.[0]?.toolSpec?.inputSchema?.json).toEqual({
|
|
103
|
+
type: 'object',
|
|
104
|
+
properties: { path: { type: 'string' } },
|
|
105
|
+
required: ['path'],
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
})
|
package/src/client.ts
CHANGED
|
@@ -24,14 +24,15 @@ import type {
|
|
|
24
24
|
TokenUsage,
|
|
25
25
|
ToolChoice,
|
|
26
26
|
} from '@namzu/sdk'
|
|
27
|
-
import type { ToolResultContent } from '@namzu/sdk'
|
|
28
|
-
import { assertThinkingUnsupported, toolResultToText } from '@namzu/sdk'
|
|
27
|
+
import type { JsonSchemaDialect, ToolResultContent } from '@namzu/sdk'
|
|
28
|
+
import { assertThinkingUnsupported, toSchemaDialect, toolResultToText } from '@namzu/sdk'
|
|
29
29
|
import {
|
|
30
30
|
ProviderRequestError,
|
|
31
31
|
isCallerAbortError,
|
|
32
32
|
isProviderRequestError,
|
|
33
33
|
providerVendorError,
|
|
34
34
|
} from '@namzu/sdk'
|
|
35
|
+
import { assertModelReachable, isAnthropicServedModel } from './model-reachability.js'
|
|
35
36
|
import type { BedrockConfig } from './types.js'
|
|
36
37
|
|
|
37
38
|
function extractSystemBlocks(messages: ChatCompletionParams['messages']): SystemContentBlock[] {
|
|
@@ -144,6 +145,13 @@ export function toBedrockToolConfig(params: ChatCompletionParams): ToolConfigura
|
|
|
144
145
|
if (params.toolChoice === 'none') return undefined
|
|
145
146
|
|
|
146
147
|
if (params.tools && params.tools.length > 0) {
|
|
148
|
+
// Claude reached through Converse is still Claude: its serving layer
|
|
149
|
+
// validates `inputSchema.json` as JSON Schema 2020-12, so a tuple
|
|
150
|
+
// rendered in draft-07's `items: [a, b]` spelling fails here for the
|
|
151
|
+
// same reason it fails on the direct wire. Converse carries other
|
|
152
|
+
// vendors too, and nothing says they read 2020-12, so the conversion
|
|
153
|
+
// follows the model rather than the endpoint.
|
|
154
|
+
const dialect: JsonSchemaDialect = isAnthropicServedModel(params.model) ? '2020-12' : 'draft-07'
|
|
147
155
|
const tools: Tool[] = params.tools.map(
|
|
148
156
|
(t) =>
|
|
149
157
|
({
|
|
@@ -151,7 +159,10 @@ export function toBedrockToolConfig(params: ChatCompletionParams): ToolConfigura
|
|
|
151
159
|
name: t.function.name,
|
|
152
160
|
description: t.function.description ?? '',
|
|
153
161
|
inputSchema: {
|
|
154
|
-
json: (
|
|
162
|
+
json: toSchemaDialect(
|
|
163
|
+
(t.function.parameters ?? {}) as Record<string, unknown>,
|
|
164
|
+
dialect,
|
|
165
|
+
),
|
|
155
166
|
},
|
|
156
167
|
},
|
|
157
168
|
}) as Tool,
|
|
@@ -283,6 +294,10 @@ export class BedrockProvider implements LLMProvider {
|
|
|
283
294
|
|
|
284
295
|
async *chatStream(params: ChatCompletionParams): AsyncIterable<StreamChunk> {
|
|
285
296
|
assertThinkingUnsupported('BedrockProvider', params)
|
|
297
|
+
// Before any AWS call: an unreachable model id fails here with the
|
|
298
|
+
// reason and the fix, rather than as an opaque validation error from
|
|
299
|
+
// a service that was asked for something this wire does not carry.
|
|
300
|
+
assertModelReachable(params.model)
|
|
286
301
|
const system = extractSystemBlocks(params.messages)
|
|
287
302
|
const messages = toBedrockMessages(params.messages)
|
|
288
303
|
const toolConfig = toBedrockToolConfig(params)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this driver's wire can serve a given model id.
|
|
3
|
+
*
|
|
4
|
+
* This driver speaks `Converse` / `ConverseStream` with ARN-versioned model
|
|
5
|
+
* ids — `anthropic.claude-sonnet-4-5-20250929-v1:0`, usually behind an
|
|
6
|
+
* inference-profile prefix (`us.`, `eu.`, `global.`). That is the integration
|
|
7
|
+
* documented for Claude 4.6 and earlier.
|
|
8
|
+
*
|
|
9
|
+
* The current generation is not on it. Claude Opus 5, Sonnet 5, Fable 5, Opus
|
|
10
|
+
* 4.8 and Opus 4.7 are served by a different Bedrock integration that speaks
|
|
11
|
+
* the Messages API shape, and their ids carry no version suffix at all
|
|
12
|
+
* (`anthropic.claude-opus-5`). The vendor's own legacy page states the reason
|
|
13
|
+
* they are absent from its model table: they do not have ARN-versioned model
|
|
14
|
+
* ids.
|
|
15
|
+
*
|
|
16
|
+
* So a caller passing a 5-series id here is not making a small mistake that a
|
|
17
|
+
* shrug would absorb — they are pointing a wire at models it was not built
|
|
18
|
+
* for, and the answer they get back is an opaque AWS validation error naming
|
|
19
|
+
* neither the cause nor the fix. Refusing with both is the whole value of
|
|
20
|
+
* knowing this.
|
|
21
|
+
*
|
|
22
|
+
* **This is a reachability check, not a capability table.** It does not claim
|
|
23
|
+
* to know which models exist, only which id SHAPE this wire accepts. A new
|
|
24
|
+
* ARN-versioned model passes without this file changing, which is the correct
|
|
25
|
+
* failure direction for a list that will go stale.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/** Inference-profile prefixes the Converse wire accepts on a model id. */
|
|
29
|
+
const PROFILE_PREFIXES = ['global.', 'us.', 'eu.', 'jp.', 'apac.']
|
|
30
|
+
|
|
31
|
+
function stripProfilePrefix(modelId: string): string {
|
|
32
|
+
for (const prefix of PROFILE_PREFIXES) {
|
|
33
|
+
if (modelId.startsWith(prefix)) return modelId.slice(prefix.length)
|
|
34
|
+
}
|
|
35
|
+
return modelId
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A Claude id with no ARN version suffix — the shape the newer Bedrock
|
|
40
|
+
* integration uses, and the one this wire cannot serve.
|
|
41
|
+
*
|
|
42
|
+
* Matched positively rather than by excluding known-good names: the set of
|
|
43
|
+
* versioned models grows, and a check that has to be edited for every new
|
|
44
|
+
* model is a check that will be wrong before it is read.
|
|
45
|
+
*/
|
|
46
|
+
const UNVERSIONED_CLAUDE = /^anthropic\.claude-(?:haiku|sonnet|opus|fable|mythos)-[a-z0-9.-]*$/
|
|
47
|
+
|
|
48
|
+
function hasArnVersion(modelId: string): boolean {
|
|
49
|
+
return /-v\d+(?::\d+)?$/.test(modelId)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Whether this id names a model Anthropic serves.
|
|
54
|
+
*
|
|
55
|
+
* Converse is a multi-vendor wire — the same request shape carries Claude,
|
|
56
|
+
* Llama, Mistral and more — so a property of the Anthropic models is not a
|
|
57
|
+
* property of the wire. Tool input schemas are one: Anthropic's serving layer
|
|
58
|
+
* validates them against JSON Schema 2020-12 regardless of which front door the
|
|
59
|
+
* request came through, while nothing says the other vendors on this wire do.
|
|
60
|
+
* Rendering the dialect Anthropic requires, only for the models that require
|
|
61
|
+
* it, is the claim that can actually be defended.
|
|
62
|
+
*/
|
|
63
|
+
export function isAnthropicServedModel(modelId: string): boolean {
|
|
64
|
+
return stripProfilePrefix(modelId.trim().toLowerCase()).startsWith('anthropic.')
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function assertModelReachable(modelId: string): void {
|
|
68
|
+
const bare = stripProfilePrefix(modelId.trim().toLowerCase())
|
|
69
|
+
if (!bare.startsWith('anthropic.')) return
|
|
70
|
+
if (hasArnVersion(bare)) return
|
|
71
|
+
if (!UNVERSIONED_CLAUDE.test(bare)) return
|
|
72
|
+
|
|
73
|
+
throw new Error(
|
|
74
|
+
`This driver cannot reach "${modelId}". It speaks Bedrock's Converse API, which serves ARN-versioned model ids such as "us.anthropic.claude-sonnet-4-5-20250929-v1:0" — Claude 4.6 and earlier. Models with no version suffix (Opus 5, Sonnet 5, Fable 5, Opus 4.8, Opus 4.7) are served by the newer Bedrock integration, which speaks the Messages API shape at a different endpoint and is not what this driver talks to. Use a versioned model id here, or reach the newer models through a driver built for that endpoint.`,
|
|
75
|
+
)
|
|
76
|
+
}
|