@opencode-ai/ai 0.0.0-dev-18042 → 0.0.0-dev-18044
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.
|
@@ -654,7 +654,9 @@ const onContentBlockStart = (state, event) => {
|
|
|
654
654
|
const block = event.content_block;
|
|
655
655
|
if (!block)
|
|
656
656
|
return [state, NO_EVENTS];
|
|
657
|
-
if (
|
|
657
|
+
if (block.type === "tool_use" || block.type === "server_tool_use") {
|
|
658
|
+
if (event.index === undefined || !block.id)
|
|
659
|
+
return [state, NO_EVENTS];
|
|
658
660
|
const events = [];
|
|
659
661
|
const lifecycle = Lifecycle.stepStart(state.lifecycle, events);
|
|
660
662
|
return [
|
|
@@ -662,7 +664,7 @@ const onContentBlockStart = (state, event) => {
|
|
|
662
664
|
...state,
|
|
663
665
|
lifecycle,
|
|
664
666
|
tools: ToolStream.start(state.tools, event.index, {
|
|
665
|
-
id: block.id
|
|
667
|
+
id: block.id,
|
|
666
668
|
name: block.name ?? "",
|
|
667
669
|
input: block.input !== undefined && (!ProviderShared.isRecord(block.input) || Object.keys(block.input).length > 0)
|
|
668
670
|
? ProviderShared.encodeJson(block.input)
|
|
@@ -673,7 +675,7 @@ const onContentBlockStart = (state, event) => {
|
|
|
673
675
|
[
|
|
674
676
|
...events,
|
|
675
677
|
LLMEvent.toolInputStart({
|
|
676
|
-
id: block.id
|
|
678
|
+
id: block.id,
|
|
677
679
|
name: block.name ?? "",
|
|
678
680
|
providerExecuted: block.type === "server_tool_use" ? true : undefined,
|
|
679
681
|
}),
|
|
@@ -836,8 +838,16 @@ const onError = (event) => Effect.fail(new AIError({
|
|
|
836
838
|
const step = (state, event) => {
|
|
837
839
|
if (event.type === "message_start")
|
|
838
840
|
return Effect.succeed(onMessageStart(state, event));
|
|
839
|
-
if (event.type === "content_block_start")
|
|
841
|
+
if (event.type === "content_block_start") {
|
|
842
|
+
const block = event.content_block;
|
|
843
|
+
if (block && (block.type === "tool_use" || block.type === "server_tool_use")) {
|
|
844
|
+
if (event.index === undefined)
|
|
845
|
+
return Effect.fail(ProviderShared.eventError(ADAPTER, `Anthropic ${block.type} missing index`));
|
|
846
|
+
if (!block.id)
|
|
847
|
+
return Effect.fail(ProviderShared.eventError(ADAPTER, `Anthropic tool_use missing id at index ${event.index}`));
|
|
848
|
+
}
|
|
840
849
|
return Effect.succeed(onContentBlockStart(state, event));
|
|
850
|
+
}
|
|
841
851
|
if (event.type === "content_block_delta")
|
|
842
852
|
return onContentBlockDelta(state, event);
|
|
843
853
|
if (event.type === "content_block_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-18044",
|
|
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.111",
|
|
33
|
-
"@opencode-ai/http-recorder": "0.0.0-dev-
|
|
33
|
+
"@opencode-ai/http-recorder": "0.0.0-dev-18044",
|
|
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-
|
|
42
|
+
"@opencode-ai/schema": "0.0.0-dev-18044",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
44
|
"effect": "4.0.0-rc.111",
|
|
45
45
|
"google-auth-library": "10.5.0"
|