@opencode/ai 0.0.0-dev-20878 → 0.0.0-dev-20879
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.
|
@@ -4,7 +4,7 @@ import { Auth } from "../auth.js";
|
|
|
4
4
|
import { render as renderEndpoint } from "../endpoint.js";
|
|
5
5
|
import { Framing } from "../framing.js";
|
|
6
6
|
import * as ProviderShared from "../../protocols/shared.js";
|
|
7
|
-
import { AIError, DEFAULT_HTTP_TIMEOUT_MS, mergeJsonRecords, TransportError, } from "../../schema/index.js";
|
|
7
|
+
import { AIError, DEFAULT_CHUNK_TIMEOUT_MS, DEFAULT_HTTP_TIMEOUT_MS, mergeJsonRecords, TransportError, } from "../../schema/index.js";
|
|
8
8
|
import { RequestExecutor } from "../executor.js";
|
|
9
9
|
const applyQuery = (url, query) => {
|
|
10
10
|
if (!query)
|
|
@@ -76,7 +76,7 @@ export const httpJson = (input) => ({
|
|
|
76
76
|
const remaining = Duration.subtract(total, Duration.millis((yield* Clock.currentTimeMillis) - started));
|
|
77
77
|
return {
|
|
78
78
|
frames: prepared.framing.frame(RequestExecutor.responseStream(response).pipe(Stream.timeoutOrElse({
|
|
79
|
-
duration: timeoutDuration(request.http?.chunkTimeout),
|
|
79
|
+
duration: timeoutDuration(request.http?.chunkTimeout, DEFAULT_CHUNK_TIMEOUT_MS),
|
|
80
80
|
orElse: () => Stream.fail(timeout("read", "Timed out waiting for response data", http)),
|
|
81
81
|
}), Stream.interruptWhen(Effect.sleep(remaining).pipe(Effect.andThen(Effect.fail(timeout("read", "Timed out waiting for the response to complete", http))))))),
|
|
82
82
|
http,
|
|
@@ -84,7 +84,7 @@ export const httpJson = (input) => ({
|
|
|
84
84
|
};
|
|
85
85
|
}),
|
|
86
86
|
});
|
|
87
|
-
const timeoutDuration = (value) => value === false ? Duration.infinity : Duration.millis(value ??
|
|
87
|
+
const timeoutDuration = (value, fallback = DEFAULT_HTTP_TIMEOUT_MS) => value === false ? Duration.infinity : Duration.millis(value ?? fallback);
|
|
88
88
|
export const sseJson = {
|
|
89
89
|
id: "http-json/sse",
|
|
90
90
|
with: () => httpJson({ framing: Framing.sse }),
|
package/dist/schema/options.d.ts
CHANGED
|
@@ -12,8 +12,13 @@ export declare const mergeProviderOptions: (...items: ReadonlyArray<ProviderOpti
|
|
|
12
12
|
/** Milliseconds for an HTTP timeout, or `false` to disable it. */
|
|
13
13
|
export declare const HttpTimeout: Schema.Union<readonly [Schema.Number, Schema.Literal<false>]>;
|
|
14
14
|
export type HttpTimeout = Schema.Schema.Type<typeof HttpTimeout>;
|
|
15
|
-
/** Applied to `headerTimeout`
|
|
15
|
+
/** Applied to `headerTimeout` when a request leaves it unset. */
|
|
16
16
|
export declare const DEFAULT_HTTP_TIMEOUT_MS = 300000;
|
|
17
|
+
/**
|
|
18
|
+
* Applied to `chunkTimeout` when a request leaves it unset. Some providers, such as DeepSeek, have specifically asked
|
|
19
|
+
* clients to allow at least 15 minutes, because their models can stream nothing for minutes while they reason.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_CHUNK_TIMEOUT_MS = 900000;
|
|
17
22
|
/** `Content-Encoding` for JSON request bodies; `none` sends plain JSON. */
|
|
18
23
|
export declare const RequestEncoding: Schema.Literals<readonly ["zstd", "gzip", "none"]>;
|
|
19
24
|
export type RequestEncoding = Schema.Schema.Type<typeof RequestEncoding>;
|
package/dist/schema/options.js
CHANGED
|
@@ -34,8 +34,13 @@ export const ProviderMetadata = Schema.Record(Schema.String, Schema.Record(Schem
|
|
|
34
34
|
export const mergeProviderOptions = (...items) => mergeJsonRecords(...items);
|
|
35
35
|
/** Milliseconds for an HTTP timeout, or `false` to disable it. */
|
|
36
36
|
export const HttpTimeout = Schema.Union([Schema.Number.check(Schema.isGreaterThan(0)), Schema.Literal(false)]);
|
|
37
|
-
/** Applied to `headerTimeout`
|
|
37
|
+
/** Applied to `headerTimeout` when a request leaves it unset. */
|
|
38
38
|
export const DEFAULT_HTTP_TIMEOUT_MS = 300_000;
|
|
39
|
+
/**
|
|
40
|
+
* Applied to `chunkTimeout` when a request leaves it unset. Some providers, such as DeepSeek, have specifically asked
|
|
41
|
+
* clients to allow at least 15 minutes, because their models can stream nothing for minutes while they reason.
|
|
42
|
+
*/
|
|
43
|
+
export const DEFAULT_CHUNK_TIMEOUT_MS = 900_000;
|
|
39
44
|
/** `Content-Encoding` for JSON request bodies; `none` sends plain JSON. */
|
|
40
45
|
export const RequestEncoding = Schema.Literals(["zstd", "gzip", "none"]);
|
|
41
46
|
export class HttpOptions extends Schema.Class("AI.HttpOptions")({
|
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-20879",
|
|
4
4
|
"name": "@opencode/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
36
36
|
"@effect/platform-node": "4.0.1",
|
|
37
|
-
"@opencode/http-recorder": "0.0.0-dev-
|
|
37
|
+
"@opencode/http-recorder": "0.0.0-dev-20879",
|
|
38
38
|
"@tsconfig/bun": "1.0.9",
|
|
39
39
|
"@types/bun": "1.4.0",
|
|
40
40
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@aws-sdk/credential-providers": "3.1057.0",
|
|
45
45
|
"@smithy/eventstream-codec": "4.2.14",
|
|
46
46
|
"@smithy/util-utf8": "4.2.2",
|
|
47
|
-
"@opencode/schema": "0.0.0-dev-
|
|
47
|
+
"@opencode/schema": "0.0.0-dev-20879",
|
|
48
48
|
"aws4fetch": "1.0.20",
|
|
49
49
|
"effect": "4.0.1",
|
|
50
50
|
"google-auth-library": "10.5.0"
|