@radheim/protocol 0.0.0-stage → 2.4.3
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/api.d.ts +60 -0
- package/dist/api.js +81 -0
- package/dist/client.d.ts +69 -0
- package/dist/client.js +102 -0
- package/dist/errors.d.ts +273 -0
- package/dist/errors.js +227 -0
- package/dist/groups/agent.d.ts +299 -0
- package/dist/groups/agent.js +30 -0
- package/dist/groups/artifact.d.ts +173 -0
- package/dist/groups/artifact.js +80 -0
- package/dist/groups/automation.d.ts +480 -0
- package/dist/groups/automation.js +55 -0
- package/dist/groups/blob.d.ts +415 -0
- package/dist/groups/blob.js +79 -0
- package/dist/groups/command.d.ts +15 -0
- package/dist/groups/command.js +20 -0
- package/dist/groups/config.d.ts +27 -0
- package/dist/groups/config.js +32 -0
- package/dist/groups/credential.d.ts +93 -0
- package/dist/groups/credential.js +50 -0
- package/dist/groups/debug.d.ts +22 -0
- package/dist/groups/debug.js +49 -0
- package/dist/groups/event.d.ts +16442 -0
- package/dist/groups/event.js +68 -0
- package/dist/groups/experimental/browser-tunnel.d.ts +20 -0
- package/dist/groups/experimental/browser-tunnel.js +29 -0
- package/dist/groups/experimental.d.ts +1519 -0
- package/dist/groups/experimental.js +12 -0
- package/dist/groups/flag.d.ts +12 -0
- package/dist/groups/flag.js +19 -0
- package/dist/groups/form.d.ts +138 -0
- package/dist/groups/form.js +18 -0
- package/dist/groups/fs.d.ts +60 -0
- package/dist/groups/fs.js +101 -0
- package/dist/groups/generate.d.ts +397 -0
- package/dist/groups/generate.js +77 -0
- package/dist/groups/integration.d.ts +1724 -0
- package/dist/groups/integration.js +169 -0
- package/dist/groups/job.d.ts +95 -0
- package/dist/groups/job.js +45 -0
- package/dist/groups/location.d.ts +23 -0
- package/dist/groups/location.js +47 -0
- package/dist/groups/machine.d.ts +91 -0
- package/dist/groups/machine.js +61 -0
- package/dist/groups/mcp.d.ts +104 -0
- package/dist/groups/mcp.js +125 -0
- package/dist/groups/media.d.ts +8 -0
- package/dist/groups/media.js +18 -0
- package/dist/groups/message.d.ts +3696 -0
- package/dist/groups/message.js +102 -0
- package/dist/groups/migration.d.ts +28 -0
- package/dist/groups/migration.js +21 -0
- package/dist/groups/model.d.ts +536 -0
- package/dist/groups/model.js +39 -0
- package/dist/groups/permission.d.ts +175 -0
- package/dist/groups/permission.js +115 -0
- package/dist/groups/persistent-pty.d.ts +251 -0
- package/dist/groups/persistent-pty.js +109 -0
- package/dist/groups/plugin.d.ts +102 -0
- package/dist/groups/plugin.js +59 -0
- package/dist/groups/project.d.ts +83 -0
- package/dist/groups/project.js +37 -0
- package/dist/groups/provider.d.ts +354 -0
- package/dist/groups/provider.js +34 -0
- package/dist/groups/pty.d.ts +151 -0
- package/dist/groups/pty.js +117 -0
- package/dist/groups/push.d.ts +123 -0
- package/dist/groups/push.js +60 -0
- package/dist/groups/reference.d.ts +25 -0
- package/dist/groups/reference.js +33 -0
- package/dist/groups/rpc.d.ts +21 -0
- package/dist/groups/rpc.js +24 -0
- package/dist/groups/server.d.ts +46 -0
- package/dist/groups/server.js +55 -0
- package/dist/groups/session.d.ts +11874 -0
- package/dist/groups/session.js +663 -0
- package/dist/groups/shell.d.ts +125 -0
- package/dist/groups/shell.js +65 -0
- package/dist/groups/skill.d.ts +26 -0
- package/dist/groups/skill.js +34 -0
- package/dist/groups/space.d.ts +56 -0
- package/dist/groups/space.js +59 -0
- package/dist/groups/usage.d.ts +96 -0
- package/dist/groups/usage.js +22 -0
- package/dist/groups/vcs.d.ts +89 -0
- package/dist/groups/vcs.js +94 -0
- package/dist/groups/voice.d.ts +81 -0
- package/dist/groups/voice.js +75 -0
- package/dist/groups/websearch.d.ts +29 -0
- package/dist/groups/websearch.js +34 -0
- package/dist/groups/worktree.d.ts +41 -0
- package/dist/groups/worktree.js +52 -0
- package/dist/middleware/authorization.d.ts +13 -0
- package/dist/middleware/authorization.js +6 -0
- package/dist/middleware/schema-error.d.ts +13 -0
- package/dist/middleware/schema-error.js +4 -0
- package/dist/simulation/image.d.ts +35 -0
- package/dist/simulation/image.js +21 -0
- package/dist/simulation/terminal.d.ts +81 -0
- package/dist/simulation/terminal.js +49 -0
- package/dist/simulation.d.ts +1784 -0
- package/dist/simulation.js +485 -0
- package/package.json +46 -4
- package/README.md +0 -3
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { Generate } from "@radheim/schema/generate";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
|
|
4
|
+
import { VideoNotFoundError, InvalidRequestError, LocationNotFoundError, ModelNotFoundError, ProviderNotFoundError, ProviderRequestError, ServiceUnavailableError, UnsupportedModelError } from "../errors.js";
|
|
5
|
+
export declare const GenerateGroup: HttpApiGroup.HttpApiGroup<"server.generate", HttpApiEndpoint.HttpApiEndpoint<"generate.decisions", "POST", "/api/experimental/generate/decisions", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
6
|
+
readonly model: Schema.Struct<{
|
|
7
|
+
readonly id: Schema.brand<Schema.String, "Model.ID">;
|
|
8
|
+
readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
|
|
9
|
+
opencode: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
10
|
+
anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
11
|
+
openai: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
12
|
+
google: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
13
|
+
googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
14
|
+
githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
15
|
+
claudeAgent: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
16
|
+
amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
17
|
+
azure: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
18
|
+
openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
19
|
+
mistral: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
20
|
+
gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
21
|
+
};
|
|
22
|
+
readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
|
|
23
|
+
}> & {
|
|
24
|
+
parse: (input: string) => {
|
|
25
|
+
readonly id: string & import("effect/Brand").Brand<"Model.ID">;
|
|
26
|
+
readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
27
|
+
readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
readonly input: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
31
|
+
readonly type: Schema.Literal<"text">;
|
|
32
|
+
readonly text: Schema.String;
|
|
33
|
+
}>, Schema.Struct<{
|
|
34
|
+
readonly type: Schema.Literal<"json">;
|
|
35
|
+
readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
36
|
+
}>, Schema.Struct<{
|
|
37
|
+
readonly data: Schema.String;
|
|
38
|
+
readonly mime: Schema.String;
|
|
39
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
40
|
+
readonly type: Schema.Literal<"file">;
|
|
41
|
+
}>]>>;
|
|
42
|
+
readonly questions: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
43
|
+
readonly type: Schema.Literal<"predicate">;
|
|
44
|
+
readonly name: Schema.String;
|
|
45
|
+
readonly instructions: Schema.String;
|
|
46
|
+
readonly criteria: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
47
|
+
readonly true: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
48
|
+
readonly false: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
49
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
50
|
+
readonly true: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
51
|
+
readonly false: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
52
|
+
}>>, never, never>;
|
|
53
|
+
}>, Schema.Struct<{
|
|
54
|
+
readonly type: Schema.Literal<"choice">;
|
|
55
|
+
readonly name: Schema.String;
|
|
56
|
+
readonly instructions: Schema.String;
|
|
57
|
+
readonly choices: Schema.$Array<Schema.Struct<{
|
|
58
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Boolean]>;
|
|
59
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
60
|
+
}>>;
|
|
61
|
+
}>, Schema.Struct<{
|
|
62
|
+
readonly type: Schema.Literal<"score">;
|
|
63
|
+
readonly name: Schema.String;
|
|
64
|
+
readonly instructions: Schema.String;
|
|
65
|
+
readonly levels: Schema.$Array<Schema.Struct<{
|
|
66
|
+
readonly label: Schema.String;
|
|
67
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
68
|
+
}>>;
|
|
69
|
+
}>]>>;
|
|
70
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
71
|
+
readonly data: Schema.Struct<{
|
|
72
|
+
readonly answers: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
73
|
+
readonly type: Schema.Literal<"predicate">;
|
|
74
|
+
readonly name: Schema.String;
|
|
75
|
+
readonly probability: Schema.Finite;
|
|
76
|
+
}>, Schema.Struct<{
|
|
77
|
+
readonly type: Schema.Literal<"choice">;
|
|
78
|
+
readonly name: Schema.String;
|
|
79
|
+
readonly choice: Schema.Union<readonly [Schema.String, Schema.Boolean]>;
|
|
80
|
+
readonly probabilities: Schema.$Array<Schema.Struct<{
|
|
81
|
+
readonly value: Schema.Union<readonly [Schema.String, Schema.Boolean]>;
|
|
82
|
+
readonly probability: Schema.Finite;
|
|
83
|
+
}>>;
|
|
84
|
+
readonly confidence: Schema.Finite;
|
|
85
|
+
}>, Schema.Struct<{
|
|
86
|
+
readonly type: Schema.Literal<"score">;
|
|
87
|
+
readonly name: Schema.String;
|
|
88
|
+
readonly score: Schema.Finite;
|
|
89
|
+
readonly probabilities: Schema.$Array<Schema.Struct<{
|
|
90
|
+
readonly value: Schema.Int;
|
|
91
|
+
readonly label: Schema.String;
|
|
92
|
+
readonly probability: Schema.Finite;
|
|
93
|
+
}>>;
|
|
94
|
+
readonly confidence: Schema.Finite;
|
|
95
|
+
}>, Schema.Struct<{
|
|
96
|
+
readonly type: Schema.Literal<"error">;
|
|
97
|
+
readonly name: Schema.String;
|
|
98
|
+
readonly reason: Schema.String;
|
|
99
|
+
readonly message: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
100
|
+
}>]>>;
|
|
101
|
+
readonly cost: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.Finite, "Money.USD"> & {
|
|
102
|
+
zero: number & import("effect/Brand").Brand<"Money.USD">;
|
|
103
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.Finite, "Money.USD"> & {
|
|
104
|
+
zero: number & import("effect/Brand").Brand<"Money.USD">;
|
|
105
|
+
}>, never, never>;
|
|
106
|
+
readonly tokens: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
107
|
+
readonly input: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
108
|
+
readonly output: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
109
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
110
|
+
readonly input: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
111
|
+
readonly output: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
112
|
+
}>>, never, never>;
|
|
113
|
+
readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
114
|
+
}>;
|
|
115
|
+
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError | typeof ProviderNotFoundError | typeof ModelNotFoundError | typeof UnsupportedModelError | typeof ProviderRequestError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"generate.image", "POST", "/api/experimental/generate/image", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
116
|
+
readonly model: Schema.Struct<{
|
|
117
|
+
readonly id: Schema.brand<Schema.String, "Model.ID">;
|
|
118
|
+
readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
|
|
119
|
+
opencode: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
120
|
+
anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
121
|
+
openai: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
122
|
+
google: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
123
|
+
googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
124
|
+
githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
125
|
+
claudeAgent: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
126
|
+
amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
127
|
+
azure: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
128
|
+
openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
129
|
+
mistral: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
130
|
+
gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
131
|
+
};
|
|
132
|
+
readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
|
|
133
|
+
}> & {
|
|
134
|
+
parse: (input: string) => {
|
|
135
|
+
readonly id: string & import("effect/Brand").Brand<"Model.ID">;
|
|
136
|
+
readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
137
|
+
readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
readonly prompt: Schema.String;
|
|
141
|
+
readonly images: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
|
|
142
|
+
readonly data: Schema.String;
|
|
143
|
+
readonly mime: Schema.String;
|
|
144
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
145
|
+
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
146
|
+
readonly data: Schema.String;
|
|
147
|
+
readonly mime: Schema.String;
|
|
148
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
149
|
+
}>>>, never, never>;
|
|
150
|
+
readonly n: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
151
|
+
readonly aspect: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<`${number}:${number}`, `${number}:${number}`, never, never>>>, Schema.optionalKey<Schema.Codec<`${number}:${number}`, `${number}:${number}`, never, never>>, never, never>;
|
|
152
|
+
readonly resolution: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Generate.ImageResolution, Generate.ImageResolution, never, never>>>, Schema.optionalKey<Schema.Codec<Generate.ImageResolution, Generate.ImageResolution, never, never>>, never, never>;
|
|
153
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
154
|
+
readonly data: Schema.Struct<{
|
|
155
|
+
readonly images: Schema.$Array<Schema.Struct<{
|
|
156
|
+
readonly data: Schema.String;
|
|
157
|
+
readonly mime: Schema.String;
|
|
158
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
159
|
+
readonly type: Schema.Literal<"image">;
|
|
160
|
+
}>>;
|
|
161
|
+
readonly cost: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.Finite, "Money.USD"> & {
|
|
162
|
+
zero: number & import("effect/Brand").Brand<"Money.USD">;
|
|
163
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.Finite, "Money.USD"> & {
|
|
164
|
+
zero: number & import("effect/Brand").Brand<"Money.USD">;
|
|
165
|
+
}>, never, never>;
|
|
166
|
+
readonly tokens: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
167
|
+
readonly input: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
168
|
+
readonly output: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
169
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
170
|
+
readonly input: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
171
|
+
readonly output: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
172
|
+
}>>, never, never>;
|
|
173
|
+
readonly native: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
174
|
+
}>;
|
|
175
|
+
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError | typeof ProviderNotFoundError | typeof ModelNotFoundError | typeof UnsupportedModelError | typeof ProviderRequestError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"generate.text", "POST", "/api/experimental/generate/text", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
176
|
+
readonly prompt: Schema.String;
|
|
177
|
+
readonly model: Schema.optional<Schema.Struct<{
|
|
178
|
+
readonly id: Schema.brand<Schema.String, "Model.ID">;
|
|
179
|
+
readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
|
|
180
|
+
opencode: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
181
|
+
anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
182
|
+
openai: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
183
|
+
google: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
184
|
+
googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
185
|
+
githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
186
|
+
claudeAgent: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
187
|
+
amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
188
|
+
azure: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
189
|
+
openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
190
|
+
mistral: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
191
|
+
gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
192
|
+
};
|
|
193
|
+
readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
|
|
194
|
+
}> & {
|
|
195
|
+
parse: (input: string) => {
|
|
196
|
+
readonly id: string & import("effect/Brand").Brand<"Model.ID">;
|
|
197
|
+
readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
198
|
+
readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
|
|
199
|
+
};
|
|
200
|
+
}>;
|
|
201
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
202
|
+
readonly data: Schema.Struct<{
|
|
203
|
+
readonly text: Schema.String;
|
|
204
|
+
}>;
|
|
205
|
+
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError | typeof ProviderNotFoundError | typeof ModelNotFoundError | typeof UnsupportedModelError | typeof ProviderRequestError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"generate.textLegacy", "POST", "/api/experimental/generate", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
206
|
+
readonly prompt: Schema.String;
|
|
207
|
+
readonly model: Schema.optional<Schema.Struct<{
|
|
208
|
+
readonly id: Schema.brand<Schema.String, "Model.ID">;
|
|
209
|
+
readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
|
|
210
|
+
opencode: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
211
|
+
anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
212
|
+
openai: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
213
|
+
google: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
214
|
+
googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
215
|
+
githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
216
|
+
claudeAgent: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
217
|
+
amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
218
|
+
azure: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
219
|
+
openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
220
|
+
mistral: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
221
|
+
gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
222
|
+
};
|
|
223
|
+
readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
|
|
224
|
+
}> & {
|
|
225
|
+
parse: (input: string) => {
|
|
226
|
+
readonly id: string & import("effect/Brand").Brand<"Model.ID">;
|
|
227
|
+
readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
228
|
+
readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
|
|
229
|
+
};
|
|
230
|
+
}>;
|
|
231
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
232
|
+
readonly data: Schema.Struct<{
|
|
233
|
+
readonly text: Schema.String;
|
|
234
|
+
}>;
|
|
235
|
+
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError | typeof ProviderNotFoundError | typeof ModelNotFoundError | typeof UnsupportedModelError | typeof ProviderRequestError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"generate.video.create", "POST", "/api/experimental/generate/video", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
236
|
+
readonly model: Schema.Struct<{
|
|
237
|
+
readonly id: Schema.brand<Schema.String, "Model.ID">;
|
|
238
|
+
readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
|
|
239
|
+
opencode: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
240
|
+
anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
241
|
+
openai: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
242
|
+
google: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
243
|
+
googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
244
|
+
githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
245
|
+
claudeAgent: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
246
|
+
amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
247
|
+
azure: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
248
|
+
openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
249
|
+
mistral: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
250
|
+
gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
251
|
+
};
|
|
252
|
+
readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
|
|
253
|
+
}> & {
|
|
254
|
+
parse: (input: string) => {
|
|
255
|
+
readonly id: string & import("effect/Brand").Brand<"Model.ID">;
|
|
256
|
+
readonly providerID: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
257
|
+
readonly variant?: (string & import("effect/Brand").Brand<"Model.VariantID">) | undefined;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
readonly prompt: Schema.String;
|
|
261
|
+
readonly start: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
262
|
+
readonly data: Schema.String;
|
|
263
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
264
|
+
readonly mime: Schema.String;
|
|
265
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
266
|
+
readonly data: Schema.String;
|
|
267
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
268
|
+
readonly mime: Schema.String;
|
|
269
|
+
}>>, never, never>;
|
|
270
|
+
readonly end: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
271
|
+
readonly data: Schema.String;
|
|
272
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
273
|
+
readonly mime: Schema.String;
|
|
274
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
275
|
+
readonly data: Schema.String;
|
|
276
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
277
|
+
readonly mime: Schema.String;
|
|
278
|
+
}>>, never, never>;
|
|
279
|
+
readonly references: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
|
|
280
|
+
readonly data: Schema.String;
|
|
281
|
+
readonly mime: Schema.String;
|
|
282
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
283
|
+
}>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
284
|
+
readonly data: Schema.String;
|
|
285
|
+
readonly mime: Schema.String;
|
|
286
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
287
|
+
}>>>, never, never>;
|
|
288
|
+
readonly duration: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
289
|
+
readonly aspect: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Generate.VideoAspect, Generate.VideoAspect, never, never>>>, Schema.optionalKey<Schema.Codec<Generate.VideoAspect, Generate.VideoAspect, never, never>>, never, never>;
|
|
290
|
+
readonly resolution: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Generate.VideoResolution, Generate.VideoResolution, never, never>>>, Schema.optionalKey<Schema.Codec<Generate.VideoResolution, Generate.VideoResolution, never, never>>, never, never>;
|
|
291
|
+
readonly sound: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
292
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
293
|
+
readonly data: Schema.Struct<{
|
|
294
|
+
readonly id: Schema.brand<Schema.String, "Generate.VideoID"> & {
|
|
295
|
+
create: () => string & import("effect/Brand").Brand<"Generate.VideoID">;
|
|
296
|
+
};
|
|
297
|
+
readonly status: Schema.Literal<"running">;
|
|
298
|
+
}>;
|
|
299
|
+
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError | typeof ProviderNotFoundError | typeof ModelNotFoundError | typeof UnsupportedModelError | typeof ProviderRequestError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"generate.video.get", "GET", "/api/experimental/generate/video/:id", Schema.toCodecStringTree<Schema.Struct<{
|
|
300
|
+
id: Schema.brand<Schema.String, "Generate.VideoID"> & {
|
|
301
|
+
create: () => string & import("effect/Brand").Brand<"Generate.VideoID">;
|
|
302
|
+
};
|
|
303
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
304
|
+
readonly data: Schema.Union<readonly [Schema.Struct<{
|
|
305
|
+
readonly id: Schema.brand<Schema.String, "Generate.VideoID"> & {
|
|
306
|
+
create: () => string & import("effect/Brand").Brand<"Generate.VideoID">;
|
|
307
|
+
};
|
|
308
|
+
readonly status: Schema.Literal<"running">;
|
|
309
|
+
}>, Schema.Struct<{
|
|
310
|
+
readonly id: Schema.brand<Schema.String, "Generate.VideoID"> & {
|
|
311
|
+
create: () => string & import("effect/Brand").Brand<"Generate.VideoID">;
|
|
312
|
+
};
|
|
313
|
+
readonly status: Schema.Literal<"completed">;
|
|
314
|
+
readonly blobs: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
315
|
+
readonly id: Schema.brand<Schema.String, "Blob.ID"> & {
|
|
316
|
+
create: () => string & import("effect/Brand").Brand<"Blob.ID">;
|
|
317
|
+
};
|
|
318
|
+
readonly sessionID: Schema.optional<Schema.brand<Schema.String, "SessionID"> & {
|
|
319
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
320
|
+
}>;
|
|
321
|
+
readonly mime: Schema.String;
|
|
322
|
+
readonly bytes: Schema.Finite;
|
|
323
|
+
readonly name: Schema.optional<Schema.String>;
|
|
324
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
325
|
+
readonly time: Schema.Struct<{
|
|
326
|
+
readonly created: Schema.Finite;
|
|
327
|
+
readonly updated: Schema.Finite;
|
|
328
|
+
}>;
|
|
329
|
+
readonly type: Schema.Literal<"image">;
|
|
330
|
+
readonly size: Schema.optional<Schema.Struct<{
|
|
331
|
+
readonly width: Schema.Finite;
|
|
332
|
+
readonly height: Schema.Finite;
|
|
333
|
+
}>>;
|
|
334
|
+
}>, Schema.Struct<{
|
|
335
|
+
readonly id: Schema.brand<Schema.String, "Blob.ID"> & {
|
|
336
|
+
create: () => string & import("effect/Brand").Brand<"Blob.ID">;
|
|
337
|
+
};
|
|
338
|
+
readonly sessionID: Schema.optional<Schema.brand<Schema.String, "SessionID"> & {
|
|
339
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
340
|
+
}>;
|
|
341
|
+
readonly mime: Schema.String;
|
|
342
|
+
readonly bytes: Schema.Finite;
|
|
343
|
+
readonly name: Schema.optional<Schema.String>;
|
|
344
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
345
|
+
readonly time: Schema.Struct<{
|
|
346
|
+
readonly created: Schema.Finite;
|
|
347
|
+
readonly updated: Schema.Finite;
|
|
348
|
+
}>;
|
|
349
|
+
readonly type: Schema.Literal<"video">;
|
|
350
|
+
readonly size: Schema.optional<Schema.Struct<{
|
|
351
|
+
readonly width: Schema.Finite;
|
|
352
|
+
readonly height: Schema.Finite;
|
|
353
|
+
}>>;
|
|
354
|
+
readonly durationMs: Schema.optional<Schema.Finite>;
|
|
355
|
+
}>, Schema.Struct<{
|
|
356
|
+
readonly id: Schema.brand<Schema.String, "Blob.ID"> & {
|
|
357
|
+
create: () => string & import("effect/Brand").Brand<"Blob.ID">;
|
|
358
|
+
};
|
|
359
|
+
readonly sessionID: Schema.optional<Schema.brand<Schema.String, "SessionID"> & {
|
|
360
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
361
|
+
}>;
|
|
362
|
+
readonly mime: Schema.String;
|
|
363
|
+
readonly bytes: Schema.Finite;
|
|
364
|
+
readonly name: Schema.optional<Schema.String>;
|
|
365
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
366
|
+
readonly time: Schema.Struct<{
|
|
367
|
+
readonly created: Schema.Finite;
|
|
368
|
+
readonly updated: Schema.Finite;
|
|
369
|
+
}>;
|
|
370
|
+
readonly type: Schema.Literal<"audio">;
|
|
371
|
+
readonly durationMs: Schema.optional<Schema.Finite>;
|
|
372
|
+
}>, Schema.Struct<{
|
|
373
|
+
readonly id: Schema.brand<Schema.String, "Blob.ID"> & {
|
|
374
|
+
create: () => string & import("effect/Brand").Brand<"Blob.ID">;
|
|
375
|
+
};
|
|
376
|
+
readonly sessionID: Schema.optional<Schema.brand<Schema.String, "SessionID"> & {
|
|
377
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
378
|
+
}>;
|
|
379
|
+
readonly mime: Schema.String;
|
|
380
|
+
readonly bytes: Schema.Finite;
|
|
381
|
+
readonly name: Schema.optional<Schema.String>;
|
|
382
|
+
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
383
|
+
readonly time: Schema.Struct<{
|
|
384
|
+
readonly created: Schema.Finite;
|
|
385
|
+
readonly updated: Schema.Finite;
|
|
386
|
+
}>;
|
|
387
|
+
readonly type: Schema.Literal<"file">;
|
|
388
|
+
}>]>>;
|
|
389
|
+
}>, Schema.Struct<{
|
|
390
|
+
readonly id: Schema.brand<Schema.String, "Generate.VideoID"> & {
|
|
391
|
+
create: () => string & import("effect/Brand").Brand<"Generate.VideoID">;
|
|
392
|
+
};
|
|
393
|
+
readonly status: Schema.Literal<"error">;
|
|
394
|
+
readonly error: Schema.String;
|
|
395
|
+
readonly reason: Schema.Literals<readonly ["failed", "cancelled", "expired", "unknown"]>;
|
|
396
|
+
}>]>;
|
|
397
|
+
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof VideoNotFoundError>, never, never>, false>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Generate } from "@radheim/schema/generate";
|
|
2
|
+
import { Model } from "@radheim/schema/model";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
|
|
5
|
+
import { VideoNotFoundError, InvalidRequestError, LocationNotFoundError, ModelNotFoundError, ProviderNotFoundError, ProviderRequestError, ServiceUnavailableError, UnsupportedModelError, } from "../errors.js";
|
|
6
|
+
const errors = [
|
|
7
|
+
InvalidRequestError,
|
|
8
|
+
ProviderNotFoundError,
|
|
9
|
+
ModelNotFoundError,
|
|
10
|
+
UnsupportedModelError,
|
|
11
|
+
ProviderRequestError,
|
|
12
|
+
ServiceUnavailableError,
|
|
13
|
+
LocationNotFoundError,
|
|
14
|
+
];
|
|
15
|
+
const textContract = {
|
|
16
|
+
payload: Schema.Struct({
|
|
17
|
+
prompt: Schema.String,
|
|
18
|
+
model: Model.Ref.pipe(Schema.optional),
|
|
19
|
+
}),
|
|
20
|
+
success: Schema.Struct({
|
|
21
|
+
data: Schema.Struct({ text: Schema.String }),
|
|
22
|
+
}).annotate({ identifier: "GenerateTextResponse" }),
|
|
23
|
+
error: errors,
|
|
24
|
+
};
|
|
25
|
+
export const GenerateGroup = HttpApiGroup.make("server.generate")
|
|
26
|
+
.add(HttpApiEndpoint.post("generate.text", "/api/experimental/generate/text", textContract).annotateMerge(OpenApi.annotations({
|
|
27
|
+
identifier: "experimental.generate.text",
|
|
28
|
+
summary: "Generate text",
|
|
29
|
+
description: "Run one stateless model generation using the server's base configuration and return the assistant text. Uses the base configuration's default model when none is specified.",
|
|
30
|
+
})))
|
|
31
|
+
// Kept so clients built before the move to /generate/text keep working; omitted from generated clients.
|
|
32
|
+
.add(HttpApiEndpoint.post("generate.textLegacy", "/api/experimental/generate", textContract).annotateMerge(OpenApi.annotations({
|
|
33
|
+
identifier: "experimental.generate.textLegacy",
|
|
34
|
+
summary: "Generate text (deprecated path)",
|
|
35
|
+
description: "Deprecated alias of POST /api/experimental/generate/text.",
|
|
36
|
+
deprecated: true,
|
|
37
|
+
})))
|
|
38
|
+
.add(HttpApiEndpoint.post("generate.image", "/api/experimental/generate/image", {
|
|
39
|
+
payload: Generate.ImageRequest,
|
|
40
|
+
success: Schema.Struct({ data: Generate.ImageResult }).annotate({ identifier: "GenerateImageResponse" }),
|
|
41
|
+
error: errors,
|
|
42
|
+
}).annotateMerge(OpenApi.annotations({
|
|
43
|
+
identifier: "experimental.generate.image",
|
|
44
|
+
summary: "Generate images",
|
|
45
|
+
description: "Generate or edit images with an image model using the server's base configuration and return them as base64. Stateless: nothing is stored.",
|
|
46
|
+
})))
|
|
47
|
+
.add(HttpApiEndpoint.post("generate.video.create", "/api/experimental/generate/video", {
|
|
48
|
+
payload: Generate.VideoRequest,
|
|
49
|
+
success: Schema.Struct({ data: Generate.VideoRunning }).annotate({ identifier: "GenerateVideoCreateResponse" }),
|
|
50
|
+
error: errors,
|
|
51
|
+
}).annotateMerge(OpenApi.annotations({
|
|
52
|
+
identifier: "experimental.generate.video.create",
|
|
53
|
+
summary: "Create a video generation",
|
|
54
|
+
description: "Submit a video job to a video model using the server's base configuration and return its ID once the provider accepted it. The server polls the job and stores the finished videos as blobs; read the job with GET /api/experimental/generate/video/:id and the video with GET /api/experimental/blob/:blobID/content. Experimental: may change without compatibility guarantees.",
|
|
55
|
+
})))
|
|
56
|
+
.add(HttpApiEndpoint.get("generate.video.get", "/api/experimental/generate/video/:id", {
|
|
57
|
+
params: { id: Generate.VideoID },
|
|
58
|
+
success: Schema.Struct({ data: Generate.VideoJob }).annotate({ identifier: "GenerateVideoGetResponse" }),
|
|
59
|
+
error: [VideoNotFoundError, LocationNotFoundError],
|
|
60
|
+
}).annotateMerge(OpenApi.annotations({
|
|
61
|
+
identifier: "experimental.generate.video.get",
|
|
62
|
+
summary: "Read a video generation",
|
|
63
|
+
description: "Read a video job: running, completed with its videos' blobs, or error with a reason. Jobs survive a server restart, which resumes polling running ones. A job is not found 24 hours after it finished, or once none of its blobs remain. Experimental: may change without compatibility guarantees.",
|
|
64
|
+
})))
|
|
65
|
+
.add(HttpApiEndpoint.post("generate.decisions", "/api/experimental/generate/decisions", {
|
|
66
|
+
payload: Generate.DecisionRequest,
|
|
67
|
+
success: Schema.Struct({ data: Generate.DecisionResult }).annotate({ identifier: "GenerateDecisionsResponse" }),
|
|
68
|
+
error: errors,
|
|
69
|
+
}).annotateMerge(OpenApi.annotations({
|
|
70
|
+
identifier: "experimental.generate.decisions",
|
|
71
|
+
summary: "Generate decisions",
|
|
72
|
+
description: "Ask a decision model typed predicate, choice and score questions about the input and return one probability-bearing answer per question, in question order. Stateless: nothing is stored.",
|
|
73
|
+
})))
|
|
74
|
+
.annotateMerge(OpenApi.annotations({
|
|
75
|
+
title: "generate",
|
|
76
|
+
description: "Experimental one-shot generation routes.",
|
|
77
|
+
}));
|