@opencode-ai/ai 0.0.0-dev-18103 → 0.0.0-dev-18105
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.
- package/dist/protocols/anthropic-messages.d.ts +3 -3
- package/dist/protocols/anthropic-messages.js +38 -4
- package/dist/providers/anthropic-compatible.d.ts +1 -1
- package/dist/providers/anthropic.d.ts +1 -1
- package/dist/providers/google-vertex-messages.d.ts +1 -1
- package/dist/schema/options.d.ts +1 -0
- package/dist/schema/options.js +1 -0
- package/package.json +3 -3
|
@@ -202,7 +202,7 @@ export declare const AnthropicMessagesBody: Schema.Struct<{
|
|
|
202
202
|
}>, Schema.Struct<{
|
|
203
203
|
readonly type: Schema.tag<"thinking">;
|
|
204
204
|
readonly thinking: Schema.String;
|
|
205
|
-
readonly signature: Schema.
|
|
205
|
+
readonly signature: Schema.String;
|
|
206
206
|
readonly cache_control: Schema.optional<Schema.Struct<{
|
|
207
207
|
readonly type: Schema.tag<"ephemeral">;
|
|
208
208
|
readonly ttl: Schema.optional<Schema.Literals<readonly ["5m", "1h"]>>;
|
|
@@ -471,11 +471,11 @@ export declare const protocol: Protocol<{
|
|
|
471
471
|
} | {
|
|
472
472
|
readonly type: "thinking";
|
|
473
473
|
readonly thinking: string;
|
|
474
|
+
readonly signature: string;
|
|
474
475
|
readonly cache_control?: {
|
|
475
476
|
readonly type: "ephemeral";
|
|
476
477
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
477
478
|
} | undefined;
|
|
478
|
-
readonly signature?: string | undefined;
|
|
479
479
|
} | {
|
|
480
480
|
readonly data: string;
|
|
481
481
|
readonly type: "redacted_thinking";
|
|
@@ -785,11 +785,11 @@ export declare const route: Route<{
|
|
|
785
785
|
} | {
|
|
786
786
|
readonly type: "thinking";
|
|
787
787
|
readonly thinking: string;
|
|
788
|
+
readonly signature: string;
|
|
788
789
|
readonly cache_control?: {
|
|
789
790
|
readonly type: "ephemeral";
|
|
790
791
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
791
792
|
} | undefined;
|
|
792
|
-
readonly signature?: string | undefined;
|
|
793
793
|
} | {
|
|
794
794
|
readonly data: string;
|
|
795
795
|
readonly type: "redacted_thinking";
|
|
@@ -96,7 +96,7 @@ const AnthropicDocumentBlock = Schema.Struct({
|
|
|
96
96
|
const AnthropicThinkingBlock = Schema.Struct({
|
|
97
97
|
type: Schema.tag("thinking"),
|
|
98
98
|
thinking: Schema.String,
|
|
99
|
-
signature: Schema.
|
|
99
|
+
signature: Schema.String,
|
|
100
100
|
cache_control: Schema.optional(AnthropicCacheControl),
|
|
101
101
|
});
|
|
102
102
|
// Safety-filtered thinking arrives as an opaque encrypted `data` payload with
|
|
@@ -574,6 +574,24 @@ const lowerToolResultContent = Effect.fnUntraced(function* (part) {
|
|
|
574
574
|
const content = part.result.value;
|
|
575
575
|
return yield* Effect.forEach(content, lowerToolResultContentItem);
|
|
576
576
|
});
|
|
577
|
+
const requireThinkingSignature = (request) => {
|
|
578
|
+
if (request.model.compatibility?.requireSignature !== undefined)
|
|
579
|
+
return request.model.compatibility.requireSignature;
|
|
580
|
+
const provider = request.model.provider.toLowerCase();
|
|
581
|
+
const model = request.model.id.toLowerCase();
|
|
582
|
+
const baseURL = (request.model.route.endpoint.baseURL ?? "").toLowerCase();
|
|
583
|
+
if (provider === "kimi-for-coding" ||
|
|
584
|
+
provider === "moonshotai" ||
|
|
585
|
+
provider === "moonshotai-cn" ||
|
|
586
|
+
model.startsWith("kimi-") ||
|
|
587
|
+
baseURL.includes("api.kimi.com/coding") ||
|
|
588
|
+
baseURL.includes("api.moonshot.ai/anthropic") ||
|
|
589
|
+
baseURL.includes("api.moonshot.cn/anthropic"))
|
|
590
|
+
return false;
|
|
591
|
+
if (provider.includes("xiaomi") || model.includes("mimo") || baseURL.includes("xiaomimimo.com"))
|
|
592
|
+
return false;
|
|
593
|
+
return true;
|
|
594
|
+
};
|
|
577
595
|
// Mid-conversation system messages became available with Opus 4.8 and version
|
|
578
596
|
// 5 of the other supported Claude families. Treat later family versions as
|
|
579
597
|
// compatible without assuming that every Anthropic Messages model is Claude.
|
|
@@ -667,15 +685,31 @@ const lowerMessages = Effect.fn("AnthropicMessages.lowerMessages")(function* (re
|
|
|
667
685
|
continue;
|
|
668
686
|
}
|
|
669
687
|
if (part.type === "reasoning") {
|
|
670
|
-
//
|
|
671
|
-
//
|
|
672
|
-
// round-trip as opaque redacted_thinking blocks.
|
|
688
|
+
// A signature marks visible thinking; only signature-less parts carrying
|
|
689
|
+
// redactedData round-trip as opaque redacted_thinking blocks.
|
|
673
690
|
const signature = part.encrypted ?? signatureFromMetadata(part.providerMetadata);
|
|
674
691
|
const redactedData = redactedDataFromMetadata(part.providerMetadata);
|
|
675
692
|
if (signature === undefined && redactedData !== undefined) {
|
|
676
693
|
content.push({ type: "redacted_thinking", data: redactedData });
|
|
677
694
|
continue;
|
|
678
695
|
}
|
|
696
|
+
if (typeof signature !== "string" || signature.trim().length === 0) {
|
|
697
|
+
if (part.text.trim().length === 0)
|
|
698
|
+
continue;
|
|
699
|
+
if (!requireThinkingSignature(request)) {
|
|
700
|
+
content.push({ type: "thinking", thinking: part.text, signature: "" });
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
// Without a signature this cannot be a valid thinking block per
|
|
704
|
+
// the SDK ThinkingBlockParam:3217 — demote to text so the
|
|
705
|
+
// conversation remains sendable.
|
|
706
|
+
content.push({
|
|
707
|
+
type: "text",
|
|
708
|
+
text: part.text,
|
|
709
|
+
cache_control: cacheControl(breakpoints, part.cache),
|
|
710
|
+
});
|
|
711
|
+
continue;
|
|
712
|
+
}
|
|
679
713
|
content.push({ type: "thinking", thinking: part.text, signature });
|
|
680
714
|
continue;
|
|
681
715
|
}
|
|
@@ -182,11 +182,11 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
182
182
|
} | {
|
|
183
183
|
readonly type: "thinking";
|
|
184
184
|
readonly thinking: string;
|
|
185
|
+
readonly signature: string;
|
|
185
186
|
readonly cache_control?: {
|
|
186
187
|
readonly type: "ephemeral";
|
|
187
188
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
188
189
|
} | undefined;
|
|
189
|
-
readonly signature?: string | undefined;
|
|
190
190
|
} | {
|
|
191
191
|
readonly data: string;
|
|
192
192
|
readonly type: "redacted_thinking";
|
|
@@ -166,11 +166,11 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
166
166
|
} | {
|
|
167
167
|
readonly type: "thinking";
|
|
168
168
|
readonly thinking: string;
|
|
169
|
+
readonly signature: string;
|
|
169
170
|
readonly cache_control?: {
|
|
170
171
|
readonly type: "ephemeral";
|
|
171
172
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
172
173
|
} | undefined;
|
|
173
|
-
readonly signature?: string | undefined;
|
|
174
174
|
} | {
|
|
175
175
|
readonly data: string;
|
|
176
176
|
readonly type: "redacted_thinking";
|
|
@@ -202,11 +202,11 @@ export declare const routes: Route<{
|
|
|
202
202
|
} | {
|
|
203
203
|
readonly type: "thinking";
|
|
204
204
|
readonly thinking: string;
|
|
205
|
+
readonly signature: string;
|
|
205
206
|
readonly cache_control?: {
|
|
206
207
|
readonly type: "ephemeral";
|
|
207
208
|
readonly ttl?: "1h" | "5m" | undefined;
|
|
208
209
|
} | undefined;
|
|
209
|
-
readonly signature?: string | undefined;
|
|
210
210
|
} | {
|
|
211
211
|
readonly data: string;
|
|
212
212
|
readonly type: "redacted_thinking";
|
package/dist/schema/options.d.ts
CHANGED
|
@@ -78,6 +78,7 @@ declare const LanguageModelCompatibility_base: Schema.Class<LanguageModelCompati
|
|
|
78
78
|
readonly supportsUsageInStreaming: Schema.optional<Schema.Boolean>;
|
|
79
79
|
readonly supportsStrictMode: Schema.optional<Schema.Boolean>;
|
|
80
80
|
readonly zaiToolStream: Schema.optional<Schema.Boolean>;
|
|
81
|
+
readonly requireSignature: Schema.optional<Schema.Boolean>;
|
|
81
82
|
}>, {}>;
|
|
82
83
|
export declare class LanguageModelCompatibility extends LanguageModelCompatibility_base {
|
|
83
84
|
}
|
package/dist/schema/options.js
CHANGED
|
@@ -105,6 +105,7 @@ export class LanguageModelCompatibility extends Schema.Class("LLM.LanguageModelC
|
|
|
105
105
|
supportsUsageInStreaming: Schema.optional(Schema.Boolean),
|
|
106
106
|
supportsStrictMode: Schema.optional(Schema.Boolean),
|
|
107
107
|
zaiToolStream: Schema.optional(Schema.Boolean),
|
|
108
|
+
requireSignature: Schema.optional(Schema.Boolean),
|
|
108
109
|
}) {
|
|
109
110
|
}
|
|
110
111
|
(function (LanguageModelCompatibility) {
|
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-18105",
|
|
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-18105",
|
|
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-18105",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
44
|
"effect": "4.0.0-rc.111",
|
|
45
45
|
"google-auth-library": "10.5.0"
|