@opencode/schema 0.0.0-dev-1136 → 0.0.0-dev-1147
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/config/provider.d.ts +2 -0
- package/dist/config/provider.js +1 -0
- package/dist/model.d.ts +4 -0
- package/dist/model.js +3 -0
- package/dist/tool.d.ts +18 -0
- package/dist/tool.js +9 -0
- package/package.json +1 -1
|
@@ -299,6 +299,7 @@ declare const ModelConfig_base: Schema.Class<ModelConfig, Schema.Struct<{
|
|
|
299
299
|
readonly package: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
300
300
|
readonly capabilities: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
301
301
|
readonly tools: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
302
|
+
readonly freeform: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Literals<("lark" | "regex" | "text")[]>>>>, Schema.optionalKey<Schema.$Array<Schema.Literals<("lark" | "regex" | "text")[]>>>, never, never>;
|
|
302
303
|
readonly input: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
|
|
303
304
|
readonly output: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
|
|
304
305
|
readonly temperature: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
@@ -331,6 +332,7 @@ declare const ModelConfig_base: Schema.Class<ModelConfig, Schema.Struct<{
|
|
|
331
332
|
}>]>>, never, never>;
|
|
332
333
|
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
333
334
|
readonly tools: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
335
|
+
readonly freeform: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Literals<("lark" | "regex" | "text")[]>>>>, Schema.optionalKey<Schema.$Array<Schema.Literals<("lark" | "regex" | "text")[]>>>, never, never>;
|
|
334
336
|
readonly input: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
|
|
335
337
|
readonly output: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
|
|
336
338
|
readonly temperature: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
package/dist/config/provider.js
CHANGED
|
@@ -75,6 +75,7 @@ class ModelConfig extends Schema.Class("Config.Model")({
|
|
|
75
75
|
// Partial: unset fields fall back to the base model's capabilities, then the defaults.
|
|
76
76
|
capabilities: Capabilities.mapFields((fields) => ({
|
|
77
77
|
tools: optional(fields.tools),
|
|
78
|
+
freeform: fields.freeform,
|
|
78
79
|
input: optional(fields.input),
|
|
79
80
|
output: optional(fields.output),
|
|
80
81
|
temperature: fields.temperature,
|
package/dist/model.d.ts
CHANGED
|
@@ -207,6 +207,8 @@ export interface Capabilities extends Schema.Schema.Type<typeof Capabilities> {
|
|
|
207
207
|
}
|
|
208
208
|
export declare const Capabilities: Schema.Struct<{
|
|
209
209
|
readonly tools: Schema.Boolean;
|
|
210
|
+
/** Freeform tool input formats advertised by the selected API. Absent or empty means JSON tools only. */
|
|
211
|
+
readonly freeform: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Literals<("lark" | "regex" | "text")[]>>>>, Schema.optionalKey<Schema.$Array<Schema.Literals<("lark" | "regex" | "text")[]>>>, never, never>;
|
|
210
212
|
readonly input: Schema.$Array<Schema.String>;
|
|
211
213
|
readonly output: Schema.$Array<Schema.String>;
|
|
212
214
|
/** Whether the model accepts a sampling temperature. Unknown when unset. */
|
|
@@ -413,6 +415,8 @@ export declare const Info: Schema.Struct<{
|
|
|
413
415
|
readonly package: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
414
416
|
readonly capabilities: Schema.Struct<{
|
|
415
417
|
readonly tools: Schema.Boolean;
|
|
418
|
+
/** Freeform tool input formats advertised by the selected API. Absent or empty means JSON tools only. */
|
|
419
|
+
readonly freeform: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Literals<("lark" | "regex" | "text")[]>>>>, Schema.optionalKey<Schema.$Array<Schema.Literals<("lark" | "regex" | "text")[]>>>, never, never>;
|
|
416
420
|
readonly input: Schema.$Array<Schema.String>;
|
|
417
421
|
readonly output: Schema.$Array<Schema.String>;
|
|
418
422
|
/** Whether the model accepts a sampling temperature. Unknown when unset. */
|
package/dist/model.js
CHANGED
|
@@ -4,6 +4,7 @@ import { optional, statics } from "./schema.js";
|
|
|
4
4
|
import { Provider } from "./provider.js";
|
|
5
5
|
import { Compatibility, MaxTokensField, MediaInput, ReasoningField } from "./model-compatibility.js";
|
|
6
6
|
import { Money } from "./money.js";
|
|
7
|
+
import { FreeformFormat } from "./tool.js";
|
|
7
8
|
import { ephemeral, inventory } from "./event.js";
|
|
8
9
|
export const ID = Schema.String.pipe(Schema.brand("Model.ID"));
|
|
9
10
|
const Updated = ephemeral({ type: "model.updated", schema: {} });
|
|
@@ -51,6 +52,8 @@ export const Overlays = {
|
|
|
51
52
|
};
|
|
52
53
|
export const Capabilities = Schema.Struct({
|
|
53
54
|
tools: Schema.Boolean,
|
|
55
|
+
/** Freeform tool input formats advertised by the selected API. Absent or empty means JSON tools only. */
|
|
56
|
+
freeform: Schema.Array(FreeformFormat).pipe(optional),
|
|
54
57
|
input: Schema.Array(Schema.String),
|
|
55
58
|
output: Schema.Array(Schema.String),
|
|
56
59
|
/** Whether the model accepts a sampling temperature. Unknown when unset. */
|
package/dist/tool.d.ts
CHANGED
|
@@ -5,6 +5,18 @@ import type { Agent } from "./agent.js";
|
|
|
5
5
|
import type { Session } from "./session.js";
|
|
6
6
|
import type { SessionMessage } from "./session-message.js";
|
|
7
7
|
export type Metadata = Readonly<Record<string, any>>;
|
|
8
|
+
/** Optional wire encoding of a tool's single required string field. Execution still receives the object. */
|
|
9
|
+
export declare const Freeform: Schema.Union<readonly [Schema.Struct<{
|
|
10
|
+
readonly type: Schema.Literal<"text">;
|
|
11
|
+
}>, Schema.Struct<{
|
|
12
|
+
readonly type: Schema.Literal<"regex">;
|
|
13
|
+
readonly pattern: Schema.String;
|
|
14
|
+
}>, Schema.Struct<{
|
|
15
|
+
readonly type: Schema.Literal<"lark">;
|
|
16
|
+
readonly grammar: Schema.String;
|
|
17
|
+
}>]>;
|
|
18
|
+
export type Freeform = typeof Freeform.Type;
|
|
19
|
+
export declare const FreeformFormat: Schema.Literals<("lark" | "regex" | "text")[]>;
|
|
8
20
|
export declare const CallID: Schema.brand<Schema.String, "Tool.CallID">;
|
|
9
21
|
export type CallID = typeof CallID.Type;
|
|
10
22
|
export interface Context {
|
|
@@ -13,6 +25,11 @@ export interface Context {
|
|
|
13
25
|
readonly messageID: SessionMessage.ID;
|
|
14
26
|
readonly id: CallID;
|
|
15
27
|
readonly progress: (update: Metadata) => Effect.Effect<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Completes when the user asks the call to stop. A tool that awaits it can stop its work and fail with what it
|
|
30
|
+
* has; a tool that does not is interrupted.
|
|
31
|
+
*/
|
|
32
|
+
readonly cancel?: Effect.Effect<void>;
|
|
16
33
|
}
|
|
17
34
|
export interface Namespace {
|
|
18
35
|
readonly name: string;
|
|
@@ -71,6 +88,7 @@ export interface Result<Output extends ValueSchema<any> | undefined = ValueSchem
|
|
|
71
88
|
export type Info<Input extends ValueSchema<any> = ValueSchema<any>, Output extends ValueSchema<any> | undefined = ValueSchema<any> | undefined> = {
|
|
72
89
|
readonly name: string;
|
|
73
90
|
readonly input: Input;
|
|
91
|
+
readonly freeform?: Freeform;
|
|
74
92
|
readonly description: string;
|
|
75
93
|
readonly execute: (input: InputValue<Input>, context: Context) => Effect.Effect<Result<Output>, Error>;
|
|
76
94
|
readonly output?: Output;
|
package/dist/tool.js
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
export * as Tool from "./tool.js";
|
|
2
2
|
import { Effect, JsonSchema, Schema } from "effect";
|
|
3
|
+
/** Optional wire encoding of a tool's single required string field. Execution still receives the object. */
|
|
4
|
+
export const Freeform = Schema.Union([
|
|
5
|
+
Schema.Struct({ type: Schema.Literal("text") }),
|
|
6
|
+
Schema.Struct({ type: Schema.Literal("regex"), pattern: Schema.String }),
|
|
7
|
+
Schema.Struct({ type: Schema.Literal("lark"), grammar: Schema.String }),
|
|
8
|
+
]).annotate({ identifier: "Tool.Freeform" });
|
|
9
|
+
export const FreeformFormat = Schema.Literals(Freeform.members.map((member) => member.fields.type.literal)).annotate({
|
|
10
|
+
identifier: "Tool.FreeformFormat",
|
|
11
|
+
});
|
|
3
12
|
export const CallID = Schema.String.pipe(Schema.brand("Tool.CallID"));
|
|
4
13
|
export class Error extends Schema.TaggedError()("Tool.Error", {
|
|
5
14
|
message: Schema.String,
|