@opencode-ai/ai 0.0.0-dev-18575 → 0.0.0-dev-18592
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.
|
@@ -799,14 +799,13 @@ const step = (state, event) => Effect.gen(function* () {
|
|
|
799
799
|
(Boolean(delta?.content) || Boolean(delta?.refusal) || toolDeltas.length > 0))
|
|
800
800
|
lifecycle = Lifecycle.reasoningStart(lifecycle, events, "reasoning-0", deltaMetadata);
|
|
801
801
|
const reasoningEmitted = state.reasoningEmitted || lifecycle.reasoning.has("reasoning-0");
|
|
802
|
-
|
|
803
|
-
|
|
802
|
+
// Reasoning is one response-wide channel: it stays open alongside text and
|
|
803
|
+
// refusal output so late reasoning deltas and details join the same block,
|
|
804
|
+
// and `finishEvents` closes it once with the complete metadata.
|
|
805
|
+
if (delta?.content)
|
|
804
806
|
lifecycle = Lifecycle.textDelta(lifecycle, events, "text-0", delta.content);
|
|
805
|
-
|
|
806
|
-
if (delta?.refusal) {
|
|
807
|
-
lifecycle = Lifecycle.reasoningEnd(lifecycle, events, "reasoning-0", reasoningMetadata(state.providerMetadataKey, reasoningField, reasoningDetailsObserved ? state.reasoningDetails : undefined));
|
|
807
|
+
if (delta?.refusal)
|
|
808
808
|
lifecycle = Lifecycle.textDelta(lifecycle, events, "text-0", delta.refusal);
|
|
809
|
-
}
|
|
810
809
|
// Compatible providers may omit indexes. Prefer durable identity, then use
|
|
811
810
|
// batch position for parallel deltas or the latest call for sparse chunks.
|
|
812
811
|
for (const [position, tool] of toolDeltas.entries()) {
|
|
@@ -894,7 +893,9 @@ const finishEvents = Effect.fn("OpenAIChat.finishEvents")(function* (state) {
|
|
|
894
893
|
normalized: state.finishReason.normalized === "stop" && hasToolCalls ? "tool-calls" : state.finishReason.normalized,
|
|
895
894
|
}
|
|
896
895
|
: { normalized: hasToolCalls ? "tool-calls" : "stop" };
|
|
897
|
-
|
|
896
|
+
// Snapshot details at publish time so the emitted event never observes later
|
|
897
|
+
// mutation of the accumulated `reasoningDetails` array.
|
|
898
|
+
const metadata = reasoningMetadata(state.providerMetadataKey, state.reasoningField, state.reasoningDetailsObserved ? [...state.reasoningDetails] : undefined);
|
|
898
899
|
const started = state.reasoningDetailsObserved && !state.reasoningEmitted
|
|
899
900
|
? Lifecycle.reasoningStart(state.lifecycle, events, "reasoning-0", reasoningMetadata(state.providerMetadataKey, state.reasoningField))
|
|
900
901
|
: state.lifecycle;
|
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-18592",
|
|
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-
|
|
33
|
+
"@opencode-ai/http-recorder": "0.0.0-dev-18592",
|
|
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-18592",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
44
|
"effect": "4.0.0-rc.112",
|
|
45
45
|
"google-auth-library": "10.5.0"
|