@opencode/ai 0.0.0-dev-20117 → 0.0.0-dev-20119
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.
|
@@ -338,10 +338,19 @@ const lowerSystem = (breakpoints, system) => {
|
|
|
338
338
|
.flatMap((part) => textWithCache(breakpoints, part.text, part.cache));
|
|
339
339
|
return content.length === 0 ? undefined : content;
|
|
340
340
|
};
|
|
341
|
+
// Nova 2 rejects `maxTokens` at high reasoning effort, where its output can exceed the field's maximum. Other models
|
|
342
|
+
// that take `reasoningConfig`, such as Grok on Bedrock, accept it.
|
|
343
|
+
const isNova2 = (model) => /\bamazon\.nova-2-/.test(model.id);
|
|
344
|
+
const isHighReasoningEffort = Schema.is(Schema.Struct({
|
|
345
|
+
additionalModelRequestFields: Schema.Struct({
|
|
346
|
+
reasoningConfig: Schema.Struct({ maxReasoningEffort: Schema.Literal("high") }),
|
|
347
|
+
}),
|
|
348
|
+
}));
|
|
341
349
|
const fromRequest = Effect.fn("BedrockConverse.fromRequest")(function* (request) {
|
|
342
350
|
const toolChoice = request.toolChoice ? yield* lowerToolChoice(request.toolChoice) : undefined;
|
|
343
351
|
const flattened = ProviderShared.flattenToolRequest(request);
|
|
344
352
|
const generation = request.generation;
|
|
353
|
+
const maxTokens = isNova2(request.model) && isHighReasoningEffort(request.http?.body) ? undefined : generation?.maxTokens;
|
|
345
354
|
// Bedrock-Claude shares Anthropic's 4-breakpoint cap. Spend the budget in
|
|
346
355
|
// tools → system → messages order to favour the highest-impact prefixes.
|
|
347
356
|
const breakpoints = BedrockCache.breakpoints(request.model.id);
|
|
@@ -361,13 +370,13 @@ const fromRequest = Effect.fn("BedrockConverse.fromRequest")(function* (request)
|
|
|
361
370
|
yield* Effect.logWarning(`Bedrock Converse: dropped ${breakpoints.dropped} cache breakpoint(s); the API allows at most ${BedrockCache.BEDROCK_BREAKPOINT_CAP} per request.`);
|
|
362
371
|
}
|
|
363
372
|
const inferenceConfig = (() => {
|
|
364
|
-
if (
|
|
373
|
+
if (maxTokens === undefined &&
|
|
365
374
|
generation?.temperature === undefined &&
|
|
366
375
|
generation?.topP === undefined &&
|
|
367
376
|
(generation?.stop === undefined || generation.stop.length === 0))
|
|
368
377
|
return undefined;
|
|
369
378
|
return {
|
|
370
|
-
maxTokens
|
|
379
|
+
maxTokens,
|
|
371
380
|
temperature: generation?.temperature,
|
|
372
381
|
topP: generation?.topP,
|
|
373
382
|
stopSequences: generation?.stop,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20119",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
36
36
|
"@effect/platform-node": "4.0.0-rc.112",
|
|
37
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
37
|
+
"@opencode/http-recorder": "0.0.0-dev-20119",
|
|
38
38
|
"@tsconfig/bun": "1.0.9",
|
|
39
39
|
"@types/bun": "1.4.0",
|
|
40
40
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
45
45
|
"@smithy/eventstream-codec": "4.2.14",
|
|
46
46
|
"@smithy/util-utf8": "4.2.2",
|
|
47
|
-
"@opencode/schema": "0.0.0-dev-
|
|
47
|
+
"@opencode/schema": "0.0.0-dev-20119",
|
|
48
48
|
"aws4fetch": "1.0.20",
|
|
49
49
|
"effect": "4.0.0-rc.112",
|
|
50
50
|
"google-auth-library": "10.5.0"
|