@opencode-ai/ai 0.0.0-beta-17577 → 0.0.0-beta-17595

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.
@@ -781,9 +781,12 @@ const onMessageDelta = (state, event) => {
781
781
  NO_EVENTS,
782
782
  ];
783
783
  };
784
- const onMessageStop = (state) => {
784
+ const onMessageStop = Effect.fn("AnthropicMessages.onMessageStop")(function* (state) {
785
+ const result = yield* ToolStream.finishAll(ADAPTER, state.tools);
785
786
  const events = [];
786
- const lifecycle = Lifecycle.finish(state.lifecycle, events, {
787
+ const lifecycle = result.events.length ? Lifecycle.stepStart(state.lifecycle, events) : state.lifecycle;
788
+ events.push(...result.events);
789
+ const finished = Lifecycle.finish(lifecycle, events, {
787
790
  reason: state.pendingFinish?.reason ?? {
788
791
  normalized: "unknown",
789
792
  raw: undefined,
@@ -791,8 +794,8 @@ const onMessageStop = (state) => {
791
794
  usage: state.usage,
792
795
  providerMetadata: state.pendingFinish?.providerMetadata,
793
796
  });
794
- return [{ ...state, lifecycle }, events];
795
- };
797
+ return [{ ...state, lifecycle: finished, tools: result.tools }, events];
798
+ });
796
799
  // Prefix `error.type` so overloads, rate limits, and quota errors are visible
797
800
  // even when the provider message is generic or empty.
798
801
  const providerErrorMessage = (event) => {
@@ -819,7 +822,7 @@ const step = (state, event) => {
819
822
  if (event.type === "message_delta")
820
823
  return Effect.succeed(onMessageDelta(state, event));
821
824
  if (event.type === "message_stop")
822
- return Effect.succeed(onMessageStop(state));
825
+ return onMessageStop(state);
823
826
  if (event.type === "error")
824
827
  return onError(event);
825
828
  return Effect.succeed([state, NO_EVENTS]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "0.0.0-beta-17577",
3
+ "version": "0.0.0-beta-17595",
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-beta.107",
33
- "@opencode-ai/http-recorder": "0.0.0-beta-17577",
33
+ "@opencode-ai/http-recorder": "0.0.0-beta-17595",
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-beta-17577",
42
+ "@opencode-ai/schema": "0.0.0-beta-17595",
43
43
  "aws4fetch": "1.0.20",
44
44
  "effect": "4.0.0-beta.107",
45
45
  "google-auth-library": "10.5.0"