@opencode/ai 0.0.0-dev-21811 → 0.0.0-dev-21817

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.
@@ -1,5 +1,10 @@
1
+ import { Schema } from "effect";
1
2
  import { Protocol } from "../route/protocol.js";
2
3
  import { OpenResponses } from "./open-responses.js";
4
+ declare const Options: Schema.Struct<{
5
+ readonly minP: Schema.optional<Schema.Number>;
6
+ }>;
7
+ export type OptionsInput = typeof Options.Type;
3
8
  export declare const protocol: Protocol<{
4
9
  readonly model: string;
5
10
  readonly input: readonly ({
@@ -181,6 +186,7 @@ export declare const protocol: Protocol<{
181
186
  readonly frequency_penalty?: number | undefined;
182
187
  readonly stream: true;
183
188
  readonly top_k?: number | undefined;
189
+ readonly min_p?: number | undefined;
184
190
  }, string, {
185
191
  readonly [x: string]: unknown;
186
192
  readonly type: string;
@@ -21,9 +21,13 @@ const XAIResponsesHostedToolItem = Schema.Union([
21
21
  error: Schema.optional(Schema.Unknown),
22
22
  }), [JsonObject]),
23
23
  ]);
24
+ const Options = Schema.Struct({
25
+ minP: Schema.optional(Schema.Number),
26
+ });
24
27
  const Body = Schema.Struct({
25
28
  ...OpenResponses.OpenResponsesBody.fields,
26
29
  top_k: Schema.optional(Schema.Number),
30
+ min_p: Schema.optional(Schema.Number),
27
31
  });
28
32
  const adapter = {
29
33
  id: ADAPTER,
@@ -47,6 +51,7 @@ const fromRequest = Effect.fn("XAIResponses.fromRequest")(function* (request) {
47
51
  route: request.model.route.id,
48
52
  message: "xAI requires explicit compaction through LLMClient.compact; automatic context management is not supported",
49
53
  });
54
+ const options = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(Options))(request.providerOptions ?? {});
50
55
  const body = yield* OpenResponses.fromRequestWithAdapter(request, adapter);
51
56
  // xAI Responses does not support penalties (they are ignored), but does support top_k.
52
57
  return {
@@ -54,6 +59,7 @@ const fromRequest = Effect.fn("XAIResponses.fromRequest")(function* (request) {
54
59
  presence_penalty: undefined,
55
60
  frequency_penalty: undefined,
56
61
  top_k: request.generation?.topK,
62
+ min_p: options.minP,
57
63
  };
58
64
  });
59
65
  const HOSTED_TOOLS = {
@@ -1,10 +1,11 @@
1
1
  import { type ProviderAuthOption } from "../route/auth-options.js";
2
2
  import { Route, type RouteDefaultsInput } from "../route/client.js";
3
3
  import { type ModelID } from "../schema/index.js";
4
+ import { XAIResponses } from "../protocols/xai-responses.js";
4
5
  import type { OpenAIOptionsInput } from "./openai-options.js";
5
6
  import type { ProviderPackage } from "../provider-package.js";
6
7
  export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
7
- export type XAIProviderOptionsInput = OpenAIOptionsInput & {
8
+ export type XAIProviderOptionsInput = OpenAIOptionsInput & XAIResponses.OptionsInput & {
8
9
  readonly contextManagement?: never;
9
10
  };
10
11
  export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
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-21811",
3
+ "version": "0.0.0-dev-21817",
4
4
  "name": "@opencode/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -35,7 +35,7 @@
35
35
  "devDependencies": {
36
36
  "@clack/prompts": "1.0.0-alpha.1",
37
37
  "@effect/platform-node": "4.0.1",
38
- "@opencode/http-recorder": "0.0.0-dev-21811",
38
+ "@opencode/http-recorder": "0.0.0-dev-21817",
39
39
  "@tsconfig/bun": "1.0.9",
40
40
  "@types/bun": "1.4.3",
41
41
  "@typescript/native": "npm:typescript@7.1.0-beta",
@@ -45,7 +45,7 @@
45
45
  "@aws-sdk/credential-providers": "3.1057.0",
46
46
  "@smithy/eventstream-codec": "4.2.14",
47
47
  "@smithy/util-utf8": "4.2.2",
48
- "@opencode/schema": "0.0.0-dev-21811",
48
+ "@opencode/schema": "0.0.0-dev-21817",
49
49
  "aws4fetch": "1.0.20",
50
50
  "effect": "4.0.1",
51
51
  "google-auth-library": "10.5.0"