@opencode-ai/ai 0.0.0-dev-18553 → 0.0.0-dev-18554

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.
@@ -129,6 +129,7 @@ export type BedrockConverseBody = Schema.Schema.Type<typeof BedrockConverseBody>
129
129
  interface ParserState {
130
130
  readonly providerMetadataKey: string;
131
131
  readonly tools: ToolStream.State<number>;
132
+ readonly finishedTools: ReadonlySet<number>;
132
133
  readonly pendingFinish: {
133
134
  readonly reason: FinishReasonDetails;
134
135
  readonly usage?: Usage;
@@ -455,6 +455,8 @@ const step = (state, event) => Effect.gen(function* () {
455
455
  }
456
456
  if (event.contentBlockDelta?.delta?.toolUse) {
457
457
  const index = event.contentBlockDelta.contentBlockIndex;
458
+ if (state.finishedTools.has(index))
459
+ return [state, []];
458
460
  const result = ToolStream.appendExisting(ADAPTER, state.tools, index, event.contentBlockDelta.delta.toolUse.input, "Bedrock Converse tool delta is missing its tool call");
459
461
  if (ToolStream.isError(result))
460
462
  return yield* result;
@@ -481,6 +483,7 @@ const step = (state, event) => Effect.gen(function* () {
481
483
  state.hasToolCalls,
482
484
  lifecycle,
483
485
  tools: result.tools,
486
+ finishedTools: resultEvents.length > 0 ? new Set([...state.finishedTools, index]) : state.finishedTools,
484
487
  reasoningSignatures: Object.fromEntries(Object.entries(state.reasoningSignatures).filter(([key]) => key !== String(index))),
485
488
  },
486
489
  events,
@@ -560,6 +563,7 @@ export const protocol = Protocol.make({
560
563
  initial: (request) => ({
561
564
  providerMetadataKey: request.model.route.providerMetadataKey ?? String(request.model.provider),
562
565
  tools: ToolStream.empty(),
566
+ finishedTools: new Set(),
563
567
  pendingFinish: undefined,
564
568
  hasToolCalls: false,
565
569
  lifecycle: Lifecycle.initial(),
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-18553",
3
+ "version": "0.0.0-dev-18554",
4
4
  "name": "@opencode-ai/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@clack/prompts": "1.0.0-alpha.1",
32
32
  "@effect/platform-node": "4.0.0-rc.112",
33
- "@opencode-ai/http-recorder": "0.0.0-dev-18553",
33
+ "@opencode-ai/http-recorder": "0.0.0-dev-18554",
34
34
  "@tsconfig/bun": "1.0.9",
35
35
  "@types/bun": "1.3.13",
36
36
  "@typescript/native-preview": "7.0.0-dev.20251207.1",
@@ -39,7 +39,7 @@
39
39
  "dependencies": {
40
40
  "@smithy/eventstream-codec": "4.2.14",
41
41
  "@smithy/util-utf8": "4.2.2",
42
- "@opencode-ai/schema": "0.0.0-dev-18553",
42
+ "@opencode-ai/schema": "0.0.0-dev-18554",
43
43
  "aws4fetch": "1.0.20",
44
44
  "effect": "4.0.0-rc.112",
45
45
  "google-auth-library": "10.5.0"