@opencode-ai/ai 0.0.0-dev-17582 → 0.0.0-dev-17604
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.
|
@@ -329,10 +329,20 @@ const lowerToolResultContent = Effect.fnUntraced(function* (part) {
|
|
|
329
329
|
const content = part.result.value;
|
|
330
330
|
return yield* Effect.forEach(content, lowerToolResultContentItem);
|
|
331
331
|
});
|
|
332
|
-
// Mid-conversation system messages
|
|
333
|
-
//
|
|
334
|
-
//
|
|
335
|
-
const supportsNativeSystemUpdates = (request) =>
|
|
332
|
+
// Mid-conversation system messages became available with Opus 4.8 and version
|
|
333
|
+
// 5 of the other supported Claude families. Treat later family versions as
|
|
334
|
+
// compatible without assuming that every Anthropic Messages model is Claude.
|
|
335
|
+
const supportsNativeSystemUpdates = (request) => {
|
|
336
|
+
const match = /(?:^|[./])claude-(fable|haiku|mythos|opus|sonnet)-(\d+)(?:[.-](\d+))?/.exec(String(request.model.id).toLowerCase());
|
|
337
|
+
if (!match)
|
|
338
|
+
return false;
|
|
339
|
+
const major = Number(match[2]);
|
|
340
|
+
if (match[1] !== "opus")
|
|
341
|
+
return major >= 5;
|
|
342
|
+
if (major !== 4)
|
|
343
|
+
return major >= 5;
|
|
344
|
+
return match[3] !== undefined && match[3].length <= 2 && Number(match[3]) >= 8;
|
|
345
|
+
};
|
|
336
346
|
const endsInServerToolUse = (message) => {
|
|
337
347
|
const last = message.content.at(-1);
|
|
338
348
|
return message.role === "assistant" && last?.type === "tool-call" && last.providerExecuted === true;
|
|
@@ -781,9 +791,12 @@ const onMessageDelta = (state, event) => {
|
|
|
781
791
|
NO_EVENTS,
|
|
782
792
|
];
|
|
783
793
|
};
|
|
784
|
-
const onMessageStop = (state)
|
|
794
|
+
const onMessageStop = Effect.fn("AnthropicMessages.onMessageStop")(function* (state) {
|
|
795
|
+
const result = yield* ToolStream.finishAll(ADAPTER, state.tools);
|
|
785
796
|
const events = [];
|
|
786
|
-
const lifecycle = Lifecycle.
|
|
797
|
+
const lifecycle = result.events.length ? Lifecycle.stepStart(state.lifecycle, events) : state.lifecycle;
|
|
798
|
+
events.push(...result.events);
|
|
799
|
+
const finished = Lifecycle.finish(lifecycle, events, {
|
|
787
800
|
reason: state.pendingFinish?.reason ?? {
|
|
788
801
|
normalized: "unknown",
|
|
789
802
|
raw: undefined,
|
|
@@ -791,8 +804,8 @@ const onMessageStop = (state) => {
|
|
|
791
804
|
usage: state.usage,
|
|
792
805
|
providerMetadata: state.pendingFinish?.providerMetadata,
|
|
793
806
|
});
|
|
794
|
-
return [{ ...state, lifecycle }, events];
|
|
795
|
-
};
|
|
807
|
+
return [{ ...state, lifecycle: finished, tools: result.tools }, events];
|
|
808
|
+
});
|
|
796
809
|
// Prefix `error.type` so overloads, rate limits, and quota errors are visible
|
|
797
810
|
// even when the provider message is generic or empty.
|
|
798
811
|
const providerErrorMessage = (event) => {
|
|
@@ -819,7 +832,7 @@ const step = (state, event) => {
|
|
|
819
832
|
if (event.type === "message_delta")
|
|
820
833
|
return Effect.succeed(onMessageDelta(state, event));
|
|
821
834
|
if (event.type === "message_stop")
|
|
822
|
-
return
|
|
835
|
+
return onMessageStop(state);
|
|
823
836
|
if (event.type === "error")
|
|
824
837
|
return onError(event);
|
|
825
838
|
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-dev-
|
|
3
|
+
"version": "0.0.0-dev-17604",
|
|
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-dev-
|
|
33
|
+
"@opencode-ai/http-recorder": "0.0.0-dev-17604",
|
|
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-17604",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
44
|
"effect": "4.0.0-beta.107",
|
|
45
45
|
"google-auth-library": "10.5.0"
|