@opencode-ai/ai 0.0.0-next-16114 → 0.0.0-next-16130

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.
@@ -63,12 +63,14 @@ declare const BedrockConverseBody: Schema.Struct<{
63
63
  readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
64
64
  readonly text: Schema.String;
65
65
  }>, Schema.Struct<{
66
- readonly reasoningContent: Schema.Struct<{
67
- readonly reasoningText: Schema.optional<Schema.Struct<{
66
+ readonly reasoningContent: Schema.Union<readonly [Schema.Struct<{
67
+ readonly reasoningText: Schema.Struct<{
68
68
  readonly text: Schema.String;
69
69
  readonly signature: Schema.optional<Schema.String>;
70
- }>>;
71
- }>;
70
+ }>;
71
+ }>, Schema.Struct<{
72
+ readonly redactedContent: Schema.String;
73
+ }>]>;
72
74
  }>, Schema.Struct<{
73
75
  readonly toolUse: Schema.Struct<{
74
76
  readonly toolUseId: Schema.String;
@@ -194,12 +196,14 @@ export declare const protocol: Protocol<{
194
196
  readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
195
197
  readonly text: Schema.String;
196
198
  }>, Schema.Struct<{
197
- readonly reasoningContent: Schema.Struct<{
198
- readonly reasoningText: Schema.optional<Schema.Struct<{
199
+ readonly reasoningContent: Schema.Union<readonly [Schema.Struct<{
200
+ readonly reasoningText: Schema.Struct<{
199
201
  readonly text: Schema.String;
200
202
  readonly signature: Schema.optional<Schema.String>;
201
- }>>;
202
- }>;
203
+ }>;
204
+ }>, Schema.Struct<{
205
+ readonly redactedContent: Schema.String;
206
+ }>]>;
203
207
  }>, Schema.Struct<{
204
208
  readonly toolUse: Schema.Struct<{
205
209
  readonly toolUseId: Schema.String;
@@ -289,6 +293,7 @@ export declare const protocol: Protocol<{
289
293
  readonly reasoningContent?: {
290
294
  readonly text?: string | undefined;
291
295
  readonly signature?: string | undefined;
296
+ readonly redactedContent?: string | undefined;
292
297
  } | undefined;
293
298
  } | undefined;
294
299
  } | undefined;
@@ -347,6 +352,7 @@ export declare const protocol: Protocol<{
347
352
  readonly reasoningContent?: {
348
353
  readonly text?: string | undefined;
349
354
  readonly signature?: string | undefined;
355
+ readonly redactedContent?: string | undefined;
350
356
  } | undefined;
351
357
  } | undefined;
352
358
  } | undefined;
@@ -429,12 +435,14 @@ export declare const route: Route<{
429
435
  readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
430
436
  readonly text: Schema.String;
431
437
  }>, Schema.Struct<{
432
- readonly reasoningContent: Schema.Struct<{
433
- readonly reasoningText: Schema.optional<Schema.Struct<{
438
+ readonly reasoningContent: Schema.Union<readonly [Schema.Struct<{
439
+ readonly reasoningText: Schema.Struct<{
434
440
  readonly text: Schema.String;
435
441
  readonly signature: Schema.optional<Schema.String>;
436
- }>>;
437
- }>;
442
+ }>;
443
+ }>, Schema.Struct<{
444
+ readonly redactedContent: Schema.String;
445
+ }>]>;
438
446
  }>, Schema.Struct<{
439
447
  readonly toolUse: Schema.Struct<{
440
448
  readonly toolUseId: Schema.String;
@@ -40,12 +40,15 @@ const BedrockToolResultBlock = Schema.Struct({
40
40
  }),
41
41
  });
42
42
  const BedrockReasoningBlock = Schema.Struct({
43
- reasoningContent: Schema.Struct({
44
- reasoningText: Schema.optional(Schema.Struct({
45
- text: Schema.String,
46
- signature: Schema.optional(Schema.String),
47
- })),
48
- }),
43
+ reasoningContent: Schema.Union([
44
+ Schema.Struct({
45
+ reasoningText: Schema.Struct({
46
+ text: Schema.String,
47
+ signature: Schema.optional(Schema.String),
48
+ }),
49
+ }),
50
+ Schema.Struct({ redactedContent: Schema.String }),
51
+ ]),
49
52
  });
50
53
  const BedrockUserBlock = Schema.Union([
51
54
  BedrockTextBlock,
@@ -124,6 +127,8 @@ const BedrockEvent = Schema.Struct({
124
127
  reasoningContent: Schema.optional(Schema.Struct({
125
128
  text: Schema.optional(Schema.String),
126
129
  signature: Schema.optional(Schema.String),
130
+ // Blob fields in Bedrock's JSON event stream are base64 strings.
131
+ redactedContent: Schema.optional(Schema.String),
127
132
  })),
128
133
  })),
129
134
  })),
@@ -178,6 +183,12 @@ const reasoningSignature = (part) => {
178
183
  return (part.encrypted ??
179
184
  (ProviderShared.isRecord(bedrock) && typeof bedrock.signature === "string" ? bedrock.signature : undefined));
180
185
  };
186
+ const reasoningRedactedData = (part) => {
187
+ const bedrock = part.providerMetadata?.bedrock;
188
+ return ProviderShared.isRecord(bedrock) && typeof bedrock.redactedData === "string"
189
+ ? bedrock.redactedData
190
+ : undefined;
191
+ };
181
192
  const lowerToolCall = (part) => ({
182
193
  toolUse: {
183
194
  toolUseId: part.id,
@@ -259,11 +270,13 @@ const lowerMessages = Effect.fn("BedrockConverse.lowerMessages")(function* (requ
259
270
  continue;
260
271
  }
261
272
  if (part.type === "reasoning") {
262
- content.push({
263
- reasoningContent: {
264
- reasoningText: { text: part.text, signature: reasoningSignature(part) },
265
- },
266
- });
273
+ const signature = reasoningSignature(part);
274
+ const redactedData = reasoningRedactedData(part);
275
+ if (signature === undefined && redactedData !== undefined) {
276
+ content.push({ reasoningContent: { redactedContent: redactedData } });
277
+ continue;
278
+ }
279
+ content.push({ reasoningContent: { reasoningText: { text: part.text, signature } } });
267
280
  continue;
268
281
  }
269
282
  if (part.type === "tool-call") {
@@ -399,12 +412,15 @@ const step = (state, event) => Effect.gen(function* () {
399
412
  const index = event.contentBlockDelta.contentBlockIndex;
400
413
  const reasoning = event.contentBlockDelta.delta.reasoningContent;
401
414
  const events = [];
415
+ const lifecycle = reasoning.text
416
+ ? Lifecycle.reasoningDelta(state.lifecycle, events, `reasoning-${index}`, reasoning.text)
417
+ : reasoning.redactedContent !== undefined
418
+ ? Lifecycle.reasoningStart(state.lifecycle, events, `reasoning-${index}`, bedrockMetadata({ redactedData: reasoning.redactedContent }))
419
+ : state.lifecycle;
402
420
  return [
403
421
  {
404
422
  ...state,
405
- lifecycle: reasoning.text
406
- ? Lifecycle.reasoningDelta(state.lifecycle, events, `reasoning-${index}`, reasoning.text)
407
- : state.lifecycle,
423
+ lifecycle,
408
424
  reasoningSignatures: reasoning.signature
409
425
  ? { ...state.reasoningSignatures, [index]: reasoning.signature }
410
426
  : state.reasoningSignatures,
@@ -76,12 +76,14 @@ export declare const routes: import("../route").Route<{
76
76
  readonly content: import("effect/Schema").$Array<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
77
77
  readonly text: import("effect/Schema").String;
78
78
  }>, import("effect/Schema").Struct<{
79
- readonly reasoningContent: import("effect/Schema").Struct<{
80
- readonly reasoningText: import("effect/Schema").optional<import("effect/Schema").Struct<{
79
+ readonly reasoningContent: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
80
+ readonly reasoningText: import("effect/Schema").Struct<{
81
81
  readonly text: import("effect/Schema").String;
82
82
  readonly signature: import("effect/Schema").optional<import("effect/Schema").String>;
83
- }>>;
84
- }>;
83
+ }>;
84
+ }>, import("effect/Schema").Struct<{
85
+ readonly redactedContent: import("effect/Schema").String;
86
+ }>]>;
85
87
  }>, import("effect/Schema").Struct<{
86
88
  readonly toolUse: import("effect/Schema").Struct<{
87
89
  readonly toolUseId: import("effect/Schema").String;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "0.0.0-next-16114",
3
+ "version": "0.0.0-next-16130",
4
4
  "name": "@opencode-ai/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "devDependencies": {
27
27
  "@clack/prompts": "1.0.0-alpha.1",
28
28
  "@effect/platform-node": "4.0.0-beta.98",
29
- "@opencode-ai/http-recorder": "0.0.0-next-16114",
29
+ "@opencode-ai/http-recorder": "0.0.0-next-16130",
30
30
  "@tsconfig/bun": "1.0.9",
31
31
  "@types/bun": "1.3.13",
32
32
  "@typescript/native-preview": "7.0.0-dev.20251207.1",
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "@smithy/eventstream-codec": "4.2.14",
37
37
  "@smithy/util-utf8": "4.2.2",
38
- "@opencode-ai/schema": "0.0.0-next-16114",
38
+ "@opencode-ai/schema": "0.0.0-next-16130",
39
39
  "aws4fetch": "1.0.20",
40
40
  "effect": "4.0.0-beta.98",
41
41
  "google-auth-library": "10.5.0"