@opencode-ai/ai 0.0.0-dev-17813 → 0.0.0-dev-17814

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.
@@ -3,6 +3,7 @@ import { Route } from "../route/client.js";
3
3
  import { Protocol } from "../route/protocol.js";
4
4
  import { HttpTransport } from "../route/transport/index.js";
5
5
  import { OpenResponses } from "./open-responses.js";
6
+ import { type Options } from "./open-responses-channel.js";
6
7
  export declare const DEFAULT_BASE_URL = "https://api.openai.com/v1";
7
8
  export declare const PATH = "/responses";
8
9
  declare const OpenAIResponsesBody: Schema.Struct<{
@@ -461,6 +462,141 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
461
462
  readonly max_tool_calls?: number | undefined;
462
463
  readonly parallel_tool_calls?: boolean | undefined;
463
464
  }, string>;
465
+ export declare const channelTransport: (options: Omit<Options, "driver">) => import("../route/transport/index.js").Transport<{
466
+ readonly input: readonly ({
467
+ readonly type: "reasoning";
468
+ readonly summary: readonly {
469
+ readonly type: "summary_text";
470
+ readonly text: string;
471
+ }[];
472
+ readonly id?: string | undefined;
473
+ readonly encrypted_content?: string | null | undefined;
474
+ } | {
475
+ readonly type: "item_reference";
476
+ readonly id: string;
477
+ } | {
478
+ readonly role: "system";
479
+ readonly content: string;
480
+ } | {
481
+ readonly role: "developer";
482
+ readonly content: string;
483
+ } | {
484
+ readonly role: "user";
485
+ readonly content: readonly ({
486
+ readonly type: "input_image";
487
+ readonly image_url: string;
488
+ } | {
489
+ readonly type: "input_file";
490
+ readonly filename: string;
491
+ readonly file_data: string;
492
+ readonly mime_type?: string | undefined;
493
+ } | {
494
+ readonly type: "input_text";
495
+ readonly text: string;
496
+ })[];
497
+ } | {
498
+ readonly type: "message";
499
+ readonly content: readonly {
500
+ readonly type: "output_text";
501
+ readonly text: string;
502
+ }[];
503
+ readonly role: "assistant";
504
+ readonly id?: string | undefined;
505
+ readonly phase?: "commentary" | "final_answer" | undefined;
506
+ } | {
507
+ readonly type: "function_call";
508
+ readonly name: string;
509
+ readonly arguments: string;
510
+ readonly call_id: string;
511
+ readonly id?: string | undefined;
512
+ } | {
513
+ readonly type: "function_call_output";
514
+ readonly call_id: string;
515
+ readonly output: string | readonly ({
516
+ readonly type: "input_image";
517
+ readonly image_url: string;
518
+ } | {
519
+ readonly type: "input_file";
520
+ readonly filename: string;
521
+ readonly file_data: string;
522
+ readonly mime_type?: string | undefined;
523
+ } | {
524
+ readonly type: "input_text";
525
+ readonly text: string;
526
+ })[];
527
+ } | {
528
+ readonly type: "message";
529
+ readonly content: readonly {
530
+ readonly type: "output_text";
531
+ readonly text: string;
532
+ }[];
533
+ readonly role: "assistant";
534
+ readonly id?: string | undefined;
535
+ readonly phase?: "commentary" | "final_answer" | null | undefined;
536
+ })[];
537
+ readonly model: string;
538
+ readonly stream: true;
539
+ readonly metadata?: {
540
+ readonly [x: string]: string;
541
+ } | undefined;
542
+ readonly instructions?: string | undefined;
543
+ readonly reasoning?: {
544
+ readonly summary?: "auto" | "concise" | "detailed" | undefined;
545
+ readonly effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined;
546
+ } | undefined;
547
+ readonly tools?: readonly ({
548
+ readonly type: "function";
549
+ readonly description: string;
550
+ readonly name: string;
551
+ readonly parameters: {
552
+ readonly [x: string]: unknown;
553
+ };
554
+ readonly strict?: boolean | undefined;
555
+ } | {
556
+ readonly type: "image_generation";
557
+ readonly size?: string | undefined;
558
+ readonly action?: "generate" | "auto" | "edit" | undefined;
559
+ readonly output_format?: "png" | "jpeg" | "webp" | undefined;
560
+ readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
561
+ readonly background?: "auto" | "opaque" | "transparent" | undefined;
562
+ readonly output_compression?: number | undefined;
563
+ readonly input_fidelity?: "low" | "high" | undefined;
564
+ readonly partial_images?: number | undefined;
565
+ })[] | undefined;
566
+ readonly text?: {
567
+ readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
568
+ } | undefined;
569
+ readonly temperature?: number | undefined;
570
+ readonly tool_choice?: "required" | "auto" | "none" | {
571
+ readonly type: "function";
572
+ readonly name: string;
573
+ } | {
574
+ readonly type: "allowed_tools";
575
+ readonly mode: "required" | "auto" | "none";
576
+ readonly tools: readonly {
577
+ readonly type: "function";
578
+ readonly name: string;
579
+ }[];
580
+ } | {
581
+ readonly type: "image_generation";
582
+ } | undefined;
583
+ readonly top_p?: number | undefined;
584
+ readonly store?: boolean | undefined;
585
+ readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined;
586
+ readonly truncation?: "auto" | "disabled" | undefined;
587
+ readonly stream_options?: {
588
+ readonly include_obfuscation?: boolean | undefined;
589
+ } | undefined;
590
+ readonly prompt_cache_key?: string | undefined;
591
+ readonly frequency_penalty?: number | undefined;
592
+ readonly presence_penalty?: number | undefined;
593
+ readonly safety_identifier?: string | undefined;
594
+ readonly top_logprobs?: number | undefined;
595
+ readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
596
+ readonly max_output_tokens?: number | undefined;
597
+ readonly max_tool_calls?: number | undefined;
598
+ readonly parallel_tool_calls?: boolean | undefined;
599
+ }, import("./open-responses-channel.js").Prepared, string>;
464
600
  export declare const transport: import("../route/transport/index.js").Transport<{
465
601
  readonly input: readonly ({
466
602
  readonly type: "reasoning";
@@ -190,12 +190,15 @@ export const protocol = Protocol.make({
190
190
  const endpoint = Endpoint.path(PATH, { baseURL: DEFAULT_BASE_URL });
191
191
  const auth = Auth.none;
192
192
  export const httpTransport = HttpTransport.sseJson.with();
193
- export const transport = OpenResponsesChannel.transport({
193
+ export const channelTransport = (options) => OpenResponsesChannel.transport({
194
+ ...options,
195
+ driver: (input) => OpenAIResponsesChannel.driver({ id: options.id, name: options.name, ...input }),
196
+ });
197
+ export const transport = channelTransport({
194
198
  id: ADAPTER,
195
199
  name: NAME,
196
200
  rotateAfterMs: WEBSOCKET_ROTATE_AFTER_MS,
197
201
  headers: (headers) => Headers.set(headers, "openai-beta", headers["openai-beta"] ?? WEBSOCKET_PROTOCOL_HEADER),
198
- driver: (input) => OpenAIResponsesChannel.driver({ id: ADAPTER, name: NAME, ...input }),
199
202
  });
200
203
  export const route = Route.make({
201
204
  id: ADAPTER,
@@ -245,7 +245,7 @@ export declare const routes: (Route<{
245
245
  readonly max_output_tokens?: number | undefined;
246
246
  readonly max_tool_calls?: number | undefined;
247
247
  readonly parallel_tool_calls?: boolean | undefined;
248
- }, import("../route/transport/http.js").HttpPrepared<string>>)[];
248
+ }, import("../protocols/open-responses-channel.js").Prepared>)[];
249
249
  export declare const configure: (input?: LanguageModelOptions) => {
250
250
  id: string & import("effect/Brand").Brand<"AI.ProviderID">;
251
251
  model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput>;
@@ -8,13 +8,18 @@ import * as OpenAIChat from "../protocols/openai-chat.js";
8
8
  import * as OpenAIResponses from "../protocols/openai-responses.js";
9
9
  import { XAIImages } from "../protocols/xai-images.js";
10
10
  export const id = ProviderID.make("xai");
11
+ const RESPONSES_WEBSOCKET_ROTATE_AFTER_MS = 24 * 60 * 1000;
11
12
  const responsesRoute = Route.make({
12
13
  id: "openai-responses",
13
14
  provider: id,
14
15
  providerMetadataKey: "xai",
15
16
  protocol: OpenAIResponses.protocol,
16
17
  endpoint: Endpoint.path("/responses", { baseURL: OpenAICompatibleProfiles.profiles.xai.baseURL }),
17
- transport: OpenAIResponses.httpTransport,
18
+ transport: OpenAIResponses.channelTransport({
19
+ id: "openai-responses",
20
+ name: "xAI Responses",
21
+ rotateAfterMs: RESPONSES_WEBSOCKET_ROTATE_AFTER_MS,
22
+ }),
18
23
  defaults: { providerOptions: { store: false } },
19
24
  });
20
25
  const chatRoute = Route.make({
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-17813",
3
+ "version": "0.0.0-dev-17814",
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.110",
33
- "@opencode-ai/http-recorder": "0.0.0-dev-17813",
33
+ "@opencode-ai/http-recorder": "0.0.0-dev-17814",
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-17813",
42
+ "@opencode-ai/schema": "0.0.0-dev-17814",
43
43
  "aws4fetch": "1.0.20",
44
44
  "effect": "4.0.0-rc.110",
45
45
  "google-auth-library": "10.5.0"