@opencode-ai/ai 0.0.0-dev-18303 → 0.0.0-dev-18304

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.
@@ -34,7 +34,12 @@ const resolve = (policy) => {
34
34
  // Protocols whose wire format ignores inline cache markers (OpenAI's implicit
35
35
  // prefix caching, Gemini's implicit + out-of-band CachedContent). Skip the
36
36
  // whole policy pass for these — emitting hints would be harmless but pointless.
37
- const RESPECTS_INLINE_HINTS = new Set(["anthropic-messages", "google-vertex-messages", "bedrock-converse", "openrouter"]);
37
+ const RESPECTS_INLINE_HINTS = new Set([
38
+ "anthropic-messages",
39
+ "google-vertex-messages",
40
+ "bedrock-converse",
41
+ "openrouter",
42
+ ]);
38
43
  const makeHint = (ttlSeconds) => ttlSeconds !== undefined ? new CacheHint({ type: "ephemeral", ttlSeconds }) : new CacheHint({ type: "ephemeral" });
39
44
  const markLastTool = (tools, hint, budget) => {
40
45
  if (tools.length === 0)
@@ -178,7 +178,11 @@ const AnthropicToolChoice = Schema.Union([
178
178
  type: Schema.Literals(["auto", "any", "none"]),
179
179
  disable_parallel_tool_use: Schema.optional(Schema.Boolean),
180
180
  }),
181
- Schema.Struct({ type: Schema.tag("tool"), name: Schema.String, disable_parallel_tool_use: Schema.optional(Schema.Boolean) }),
181
+ Schema.Struct({
182
+ type: Schema.tag("tool"),
183
+ name: Schema.String,
184
+ disable_parallel_tool_use: Schema.optional(Schema.Boolean),
185
+ }),
182
186
  ]);
183
187
  const AnthropicThinking = Schema.Union([
184
188
  Schema.Struct({
@@ -382,7 +386,11 @@ const lowerServerToolResult = Effect.fn("AnthropicMessages.lowerServerToolResult
382
386
  // Prefer the provider-owned replay payload; fall back to the result value for
383
387
  // histories constructed directly from provider events.
384
388
  const payload = part.providerMetadata?.anthropic?.["result"] ?? part.result.value;
385
- return { type: wireType, tool_use_id: scrubToolCallID(part.id), content: payload };
389
+ return {
390
+ type: wireType,
391
+ tool_use_id: scrubToolCallID(part.id),
392
+ content: payload,
393
+ };
386
394
  });
387
395
  const fileIdFromMetadata = (metadata) => {
388
396
  if (!ProviderShared.isRecord(metadata))
@@ -754,13 +762,13 @@ const lowerMessages = Effect.fn("AnthropicMessages.lowerMessages")(function* (re
754
762
  });
755
763
  const resolveOptions = Effect.fn("AnthropicMessages.resolveOptions")(function* (request) {
756
764
  const input = request.providerOptions;
757
- const rawServiceTier = input?.service_tier ?? input?.serviceTier;
765
+ const rawServiceTier = input?.service_tier ??
766
+ input?.serviceTier;
758
767
  const service_tier = rawServiceTier === "auto" || rawServiceTier === "standard_only"
759
768
  ? rawServiceTier
760
769
  : undefined;
761
770
  const rawMetadata = input?.metadata;
762
- const metadata = ProviderShared.isRecord(rawMetadata) &&
763
- (typeof rawMetadata.user_id === "string" || rawMetadata.user_id === null)
771
+ const metadata = ProviderShared.isRecord(rawMetadata) && (typeof rawMetadata.user_id === "string" || rawMetadata.user_id === null)
764
772
  ? { user_id: rawMetadata.user_id }
765
773
  : undefined;
766
774
  const container = typeof input?.container === "string" ||
@@ -1251,7 +1259,9 @@ export const route = Route.make({
1251
1259
  provider: "anthropic",
1252
1260
  providerMetadataKey: "anthropic",
1253
1261
  protocol,
1254
- endpoint: Endpoint.path((input) => (input.request.model.provider === "anthropic" ? `${PATH}?beta=true` : PATH), { baseURL: DEFAULT_BASE_URL }),
1262
+ endpoint: Endpoint.path((input) => (input.request.model.provider === "anthropic" ? `${PATH}?beta=true` : PATH), {
1263
+ baseURL: DEFAULT_BASE_URL,
1264
+ }),
1255
1265
  auth: Auth.none,
1256
1266
  framing,
1257
1267
  headers: () => ({ "anthropic-version": "2023-06-01" }),
@@ -508,7 +508,9 @@ const step = (state, event) => Effect.gen(function* () {
508
508
  module: ADAPTER,
509
509
  method: "stream",
510
510
  reason: classifyProviderFailure({
511
- message: event.exception.details.message ?? event.exception.details.originalMessage ?? "Bedrock Converse stream error",
511
+ message: event.exception.details.message ??
512
+ event.exception.details.originalMessage ??
513
+ "Bedrock Converse stream error",
512
514
  code: event.exception.type,
513
515
  }),
514
516
  });
@@ -535,7 +535,9 @@ const step = (state, event) => {
535
535
  id,
536
536
  name: part.functionCall.name,
537
537
  input,
538
- providerMetadata: part.thoughtSignature ? googleMetadata({ thoughtSignature: part.thoughtSignature }) : undefined,
538
+ providerMetadata: part.thoughtSignature
539
+ ? googleMetadata({ thoughtSignature: part.thoughtSignature })
540
+ : undefined,
539
541
  }));
540
542
  hasToolCalls = true;
541
543
  }
@@ -361,7 +361,10 @@ const lowerMessages = Effect.fn("OpenAIChat.lowerMessages")(function* (request,
361
361
  ...options,
362
362
  toolCallID: (id) => {
363
363
  if (mistral)
364
- return id.replace(/[^a-zA-Z0-9]/g, "").slice(0, 9).padEnd(9, "0");
364
+ return id
365
+ .replace(/[^a-zA-Z0-9]/g, "")
366
+ .slice(0, 9)
367
+ .padEnd(9, "0");
365
368
  if (modelID.includes("claude"))
366
369
  return id.replace(/[^a-zA-Z0-9_-]/g, "_");
367
370
  if (request.model.provider === "openai" || request.model.provider === "azure" || modelID.startsWith("openai/"))
@@ -424,7 +427,8 @@ const lowerMessages = Effect.fn("OpenAIChat.lowerMessages")(function* (request,
424
427
  : { role: "user", content: part.text });
425
428
  continue;
426
429
  }
427
- if (message.role === "assistant" && message.content.every((part) => part.type === "text" && part.text.trim() === ""))
430
+ if (message.role === "assistant" &&
431
+ message.content.every((part) => part.type === "text" && part.text.trim() === ""))
428
432
  continue;
429
433
  if (message.role === "tool") {
430
434
  const lowered = yield* lowerToolMessages(message, lowering);
@@ -573,8 +577,7 @@ export const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* (reques
573
577
  const supportsStore = request.model.compatibility?.supportsStore ?? detectSupportsStore(provider, baseURL);
574
578
  const supportsUsageInStreaming = request.model.compatibility?.supportsUsageInStreaming ?? detectSupportsUsageInStreaming();
575
579
  const supportsStrictMode = request.model.compatibility?.supportsStrictMode ?? detectSupportsStrictMode(provider, baseURL);
576
- const zaiToolStream = request.model.compatibility?.zaiToolStream ??
577
- detectZaiToolStream(provider, baseURL, request.model.id);
580
+ const zaiToolStream = request.model.compatibility?.zaiToolStream ?? detectZaiToolStream(provider, baseURL, request.model.id);
578
581
  const hasHistory = hasToolHistory(request.messages);
579
582
  const hasActiveTools = request.tools.length > 0;
580
583
  return {
@@ -14,7 +14,9 @@ export const ResponseIncludables = [
14
14
  "message.output_text.logprobs",
15
15
  ];
16
16
  export const ServiceTiers = ["auto", "default", "flex", "priority"];
17
- export const ServiceTier = Schema.declare((value) => typeof value === "string", { title: "ServiceTier" });
17
+ export const ServiceTier = Schema.declare((value) => typeof value === "string", {
18
+ title: "ServiceTier",
19
+ });
18
20
  export const Truncations = ["auto", "disabled"];
19
21
  export const TextVerbositySchema = TextVerbosity;
20
22
  export const ResponseIncludableSchema = Schema.declare((value) => typeof value === "string", { title: "ResponseIncludable" });
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-18303",
3
+ "version": "0.0.0-dev-18304",
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-18303",
33
+ "@opencode-ai/http-recorder": "0.0.0-dev-18304",
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-18303",
42
+ "@opencode-ai/schema": "0.0.0-dev-18304",
43
43
  "aws4fetch": "1.0.20",
44
44
  "effect": "4.0.0-rc.111",
45
45
  "google-auth-library": "10.5.0"