@opencode/ai 0.0.0-dev-21479 → 0.0.0-dev-21489
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/generation.js
CHANGED
|
@@ -110,6 +110,6 @@ const within = (effect, id, timeout, deadline) => Clock.currentTimeMillis.pipe(E
|
|
|
110
110
|
const timeoutError = (id, timeout) => new AIError({
|
|
111
111
|
reason: new TimeoutError({
|
|
112
112
|
message: `Generation ${id} did not finish within ${Duration.format(timeout)}`,
|
|
113
|
-
timeoutMs: Duration.toMillis(timeout),
|
|
113
|
+
timeoutMs: Math.min(Number.MAX_SAFE_INTEGER, Math.max(0, Math.ceil(Duration.toMillis(timeout)))),
|
|
114
114
|
}),
|
|
115
115
|
});
|
package/dist/schema/errors.d.ts
CHANGED
|
@@ -153,7 +153,7 @@ declare const TimeoutError_base: Schema.Class<TimeoutError, Schema.TaggedStruct<
|
|
|
153
153
|
readonly body: Schema.optional<Schema.String>;
|
|
154
154
|
readonly http: Schema.optional<typeof HttpContext>;
|
|
155
155
|
readonly cause: Schema.optional<Schema.Defect>;
|
|
156
|
-
readonly timeoutMs: Schema.optional<Schema.
|
|
156
|
+
readonly timeoutMs: Schema.optional<Schema.Int>;
|
|
157
157
|
}>, import("effect/Cause").YieldableError>;
|
|
158
158
|
/** A caller-supplied deadline elapsed, such as `Generation.await` polling past its `Poll.timeout`. */
|
|
159
159
|
export declare class TimeoutError extends TimeoutError_base {
|
package/dist/schema/errors.js
CHANGED
|
@@ -104,7 +104,7 @@ export class UnknownProviderError extends Schema.TaggedError("AI.Error.UnknownPr
|
|
|
104
104
|
/** A caller-supplied deadline elapsed, such as `Generation.await` polling past its `Poll.timeout`. */
|
|
105
105
|
export class TimeoutError extends Schema.TaggedError("AI.Error.Timeout")("Timeout", {
|
|
106
106
|
...ReasonFields,
|
|
107
|
-
timeoutMs: Schema.optional(
|
|
107
|
+
timeoutMs: Schema.optional(NonNegativeInt),
|
|
108
108
|
}) {
|
|
109
109
|
}
|
|
110
110
|
export const AIErrorReason = Schema.Union([
|
package/dist/schema/messages.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
1
|
+
import { Option, Schema } from "effect";
|
|
2
2
|
import { withStatics } from "@opencode/schema/schema";
|
|
3
3
|
import { Tool } from "@opencode/schema/tool";
|
|
4
4
|
import { CacheHint, CachePolicy, GenerationOptions, HttpOptions, JsonSchema, LanguageModelSchema, ProviderMetadata, ProviderOptions, ReasoningEffort, } from "./options.js";
|
|
5
5
|
import { ProviderID } from "./ids.js";
|
|
6
6
|
import { Media } from "../media.js";
|
|
7
|
+
import { Json } from "../utils/json.js";
|
|
7
8
|
export const MessageRole = Schema.Literals(["system", "user", "assistant", "tool"]);
|
|
8
9
|
const systemPartSchema = Schema.Struct({
|
|
9
10
|
type: Schema.Literal("text"),
|
|
@@ -89,15 +90,11 @@ export const ToolOutput = withStatics(Schema.Struct({
|
|
|
89
90
|
return { type: "content", value: output.content };
|
|
90
91
|
},
|
|
91
92
|
});
|
|
93
|
+
const encodeJsonOption = Schema.encodeUnknownOption(Json);
|
|
92
94
|
const toolResultText = (value) => {
|
|
93
95
|
if (typeof value === "string")
|
|
94
96
|
return value;
|
|
95
|
-
|
|
96
|
-
return JSON.stringify(value) ?? String(value);
|
|
97
|
-
}
|
|
98
|
-
catch {
|
|
99
|
-
return String(value);
|
|
100
|
-
}
|
|
97
|
+
return Option.getOrElse(encodeJsonOption(value), () => String(value));
|
|
101
98
|
};
|
|
102
99
|
export const ToolCallPart = withStatics(Schema.Struct({
|
|
103
100
|
type: Schema.Literal("tool-call"),
|
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-21489",
|
|
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-21489",
|
|
38
38
|
"@tsconfig/bun": "1.0.9",
|
|
39
39
|
"@types/bun": "1.4.0",
|
|
40
40
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
@@ -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-21489",
|
|
48
48
|
"aws4fetch": "1.0.20",
|
|
49
49
|
"effect": "4.0.1",
|
|
50
50
|
"google-auth-library": "10.5.0"
|