@kilocode/protocol 0.0.0-stage → 0.0.0-v2-9
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 +58 -0
- package/dist/api.js +77 -0
- package/dist/client.d.ts +63 -0
- package/dist/client.js +55 -0
- package/dist/errors.d.ts +193 -0
- package/dist/errors.js +152 -0
- package/dist/groups/agent.d.ts +225 -0
- package/dist/groups/agent.js +30 -0
- package/dist/groups/command.d.ts +15 -0
- package/dist/groups/command.js +20 -0
- package/dist/groups/config.d.ts +14 -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 +14853 -0
- package/dist/groups/event.js +51 -0
- package/dist/groups/form.d.ts +138 -0
- package/dist/groups/form.js +18 -0
- package/dist/groups/fs.d.ts +48 -0
- package/dist/groups/fs.js +73 -0
- package/dist/groups/generate.d.ts +33 -0
- package/dist/groups/generate.js +23 -0
- package/dist/groups/integration.d.ts +1724 -0
- package/dist/groups/integration.js +169 -0
- package/dist/groups/location.d.ts +23 -0
- package/dist/groups/location.js +45 -0
- package/dist/groups/mcp.d.ts +103 -0
- package/dist/groups/mcp.js +114 -0
- package/dist/groups/message.d.ts +1416 -0
- package/dist/groups/message.js +77 -0
- package/dist/groups/migration.d.ts +28 -0
- package/dist/groups/migration.js +21 -0
- package/dist/groups/model.d.ts +399 -0
- package/dist/groups/model.js +33 -0
- package/dist/groups/permission.d.ts +175 -0
- package/dist/groups/permission.js +110 -0
- package/dist/groups/persistent-pty.d.ts +242 -0
- package/dist/groups/persistent-pty.js +92 -0
- package/dist/groups/plugin.d.ts +86 -0
- package/dist/groups/plugin.js +45 -0
- package/dist/groups/project.d.ts +83 -0
- package/dist/groups/project.js +33 -0
- package/dist/groups/provider.d.ts +231 -0
- package/dist/groups/provider.js +34 -0
- package/dist/groups/pty.d.ts +151 -0
- package/dist/groups/pty.js +112 -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 +44 -0
- package/dist/groups/server.js +53 -0
- package/dist/groups/session.d.ts +11380 -0
- package/dist/groups/session.js +611 -0
- package/dist/groups/shell.d.ts +125 -0
- package/dist/groups/shell.js +64 -0
- package/dist/groups/skill.d.ts +19 -0
- package/dist/groups/skill.js +20 -0
- package/dist/groups/vcs.d.ts +87 -0
- package/dist/groups/vcs.js +93 -0
- package/dist/groups/voice.d.ts +93 -0
- package/dist/groups/voice.js +89 -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.d.ts +1830 -0
- package/dist/simulation.js +497 -0
- package/package.json +45 -4
- package/README.md +0 -3
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
|
|
3
|
+
import { ShellNotFoundError } from "../errors.js";
|
|
4
|
+
export declare const ShellGroup: HttpApiGroup.HttpApiGroup<"server.shell", HttpApiEndpoint.HttpApiEndpoint<"shell.create", "POST", "/api/shell", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
5
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
6
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
7
|
+
}>>;
|
|
8
|
+
}>>, Schema.toCodecJson<Schema.Struct<{
|
|
9
|
+
readonly command: Schema.String;
|
|
10
|
+
readonly cwd: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
11
|
+
readonly timeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
12
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
13
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
14
|
+
readonly location: Schema.Struct<{
|
|
15
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
16
|
+
}>;
|
|
17
|
+
readonly data: Schema.Struct<{
|
|
18
|
+
readonly id: Schema.brand<Schema.String, "Shell.ID"> & {
|
|
19
|
+
create: () => string & import("effect/Brand").Brand<"Shell.ID">;
|
|
20
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Shell.ID">;
|
|
21
|
+
};
|
|
22
|
+
readonly status: Schema.Literals<readonly ["running", "exited", "timeout", "killed"]>;
|
|
23
|
+
readonly command: Schema.String;
|
|
24
|
+
readonly cwd: Schema.String;
|
|
25
|
+
readonly shell: Schema.String;
|
|
26
|
+
readonly file: Schema.String;
|
|
27
|
+
readonly pid: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
28
|
+
readonly exit: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
29
|
+
readonly signal: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
30
|
+
readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
31
|
+
readonly time: Schema.Struct<{
|
|
32
|
+
readonly started: Schema.Finite;
|
|
33
|
+
readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
34
|
+
}>;
|
|
35
|
+
}>;
|
|
36
|
+
}>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"shell.get", "GET", "/api/shell/:id", Schema.toCodecStringTree<Schema.Struct<{
|
|
37
|
+
id: Schema.brand<Schema.String, "Shell.ID"> & {
|
|
38
|
+
create: () => string & import("effect/Brand").Brand<"Shell.ID">;
|
|
39
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Shell.ID">;
|
|
40
|
+
};
|
|
41
|
+
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
42
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
43
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
44
|
+
}>>;
|
|
45
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
46
|
+
readonly location: Schema.Struct<{
|
|
47
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
48
|
+
}>;
|
|
49
|
+
readonly data: Schema.Struct<{
|
|
50
|
+
readonly id: Schema.brand<Schema.String, "Shell.ID"> & {
|
|
51
|
+
create: () => string & import("effect/Brand").Brand<"Shell.ID">;
|
|
52
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Shell.ID">;
|
|
53
|
+
};
|
|
54
|
+
readonly status: Schema.Literals<readonly ["running", "exited", "timeout", "killed"]>;
|
|
55
|
+
readonly command: Schema.String;
|
|
56
|
+
readonly cwd: Schema.String;
|
|
57
|
+
readonly shell: Schema.String;
|
|
58
|
+
readonly file: Schema.String;
|
|
59
|
+
readonly pid: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
60
|
+
readonly exit: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
61
|
+
readonly signal: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
62
|
+
readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
63
|
+
readonly time: Schema.Struct<{
|
|
64
|
+
readonly started: Schema.Finite;
|
|
65
|
+
readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
66
|
+
}>;
|
|
67
|
+
}>;
|
|
68
|
+
}>>, Schema.toCodecJson<typeof ShellNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"shell.list", "GET", "/api/shell", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
69
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
70
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
71
|
+
}>>;
|
|
72
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
73
|
+
readonly location: Schema.Struct<{
|
|
74
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
75
|
+
}>;
|
|
76
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
77
|
+
readonly id: Schema.brand<Schema.String, "Shell.ID"> & {
|
|
78
|
+
create: () => string & import("effect/Brand").Brand<"Shell.ID">;
|
|
79
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Shell.ID">;
|
|
80
|
+
};
|
|
81
|
+
readonly status: Schema.Literals<readonly ["running", "exited", "timeout", "killed"]>;
|
|
82
|
+
readonly command: Schema.String;
|
|
83
|
+
readonly cwd: Schema.String;
|
|
84
|
+
readonly shell: Schema.String;
|
|
85
|
+
readonly file: Schema.String;
|
|
86
|
+
readonly pid: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
87
|
+
readonly exit: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
88
|
+
readonly signal: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
89
|
+
readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
90
|
+
readonly time: Schema.Struct<{
|
|
91
|
+
readonly started: Schema.Finite;
|
|
92
|
+
readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
|
|
93
|
+
}>;
|
|
94
|
+
}>>;
|
|
95
|
+
}>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"shell.output", "GET", "/api/shell/:id/output", Schema.toCodecStringTree<Schema.Struct<{
|
|
96
|
+
id: Schema.brand<Schema.String, "Shell.ID"> & {
|
|
97
|
+
create: () => string & import("effect/Brand").Brand<"Shell.ID">;
|
|
98
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Shell.ID">;
|
|
99
|
+
};
|
|
100
|
+
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
101
|
+
readonly cursor: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
102
|
+
readonly limit: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
103
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
104
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
105
|
+
}>>;
|
|
106
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
107
|
+
readonly location: Schema.Struct<{
|
|
108
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
109
|
+
}>;
|
|
110
|
+
readonly data: Schema.Struct<{
|
|
111
|
+
readonly output: Schema.String;
|
|
112
|
+
readonly cursor: Schema.Int;
|
|
113
|
+
readonly size: Schema.Int;
|
|
114
|
+
readonly truncated: Schema.Boolean;
|
|
115
|
+
}>;
|
|
116
|
+
}>>, Schema.toCodecJson<typeof ShellNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"shell.remove", "DELETE", "/api/shell/:id", Schema.toCodecStringTree<Schema.Struct<{
|
|
117
|
+
id: Schema.brand<Schema.String, "Shell.ID"> & {
|
|
118
|
+
create: () => string & import("effect/Brand").Brand<"Shell.ID">;
|
|
119
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Shell.ID">;
|
|
120
|
+
};
|
|
121
|
+
}>>, Schema.toCodecStringTree<Schema.Struct<{
|
|
122
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
123
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
124
|
+
}>>;
|
|
125
|
+
}>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, never, never>, false>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Shell } from "@opencode/schema/shell";
|
|
2
|
+
import { Location } from "@opencode/schema/location";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
5
|
+
import { ShellNotFoundError } from "../errors.js";
|
|
6
|
+
import { LocationQuery, locationQueryOpenApi } from "./location.js";
|
|
7
|
+
export const ShellGroup = HttpApiGroup.make("server.shell")
|
|
8
|
+
.add(HttpApiEndpoint.get("shell.list", "/api/shell", {
|
|
9
|
+
query: LocationQuery,
|
|
10
|
+
success: Location.response(Schema.Array(Shell.Info)),
|
|
11
|
+
})
|
|
12
|
+
.annotateMerge(locationQueryOpenApi)
|
|
13
|
+
.annotateMerge(OpenApi.annotations({
|
|
14
|
+
identifier: "shell.list",
|
|
15
|
+
summary: "List running shell commands",
|
|
16
|
+
description: "List currently running shell commands for a location. Exited commands are not included.",
|
|
17
|
+
})))
|
|
18
|
+
.add(HttpApiEndpoint.post("shell.create", "/api/shell", {
|
|
19
|
+
query: LocationQuery,
|
|
20
|
+
payload: Shell.CreateInput,
|
|
21
|
+
success: Location.response(Shell.Info),
|
|
22
|
+
})
|
|
23
|
+
.annotateMerge(locationQueryOpenApi)
|
|
24
|
+
.annotateMerge(OpenApi.annotations({
|
|
25
|
+
identifier: "shell.create",
|
|
26
|
+
summary: "Run shell command",
|
|
27
|
+
description: "Spawn one non-interactive shell command for a location. Combined stdout/stderr is captured to a file pageable via output.",
|
|
28
|
+
})))
|
|
29
|
+
.add(HttpApiEndpoint.get("shell.get", "/api/shell/:id", {
|
|
30
|
+
params: { id: Shell.ID },
|
|
31
|
+
query: LocationQuery,
|
|
32
|
+
success: Location.response(Shell.Info),
|
|
33
|
+
error: ShellNotFoundError,
|
|
34
|
+
})
|
|
35
|
+
.annotateMerge(locationQueryOpenApi)
|
|
36
|
+
.annotateMerge(OpenApi.annotations({
|
|
37
|
+
identifier: "shell.get",
|
|
38
|
+
summary: "Get shell command",
|
|
39
|
+
description: "Get one shell command, including its status and exit code once exited.",
|
|
40
|
+
})))
|
|
41
|
+
.add(HttpApiEndpoint.get("shell.output", "/api/shell/:id/output", {
|
|
42
|
+
params: { id: Shell.ID },
|
|
43
|
+
query: Schema.Struct({ ...LocationQuery.fields, ...Shell.OutputInput.fields }),
|
|
44
|
+
success: Location.response(Shell.Output),
|
|
45
|
+
error: ShellNotFoundError,
|
|
46
|
+
})
|
|
47
|
+
.annotateMerge(locationQueryOpenApi)
|
|
48
|
+
.annotateMerge(OpenApi.annotations({
|
|
49
|
+
identifier: "shell.output",
|
|
50
|
+
summary: "Read shell output",
|
|
51
|
+
description: "Page through captured combined output by absolute byte cursor.",
|
|
52
|
+
})))
|
|
53
|
+
.add(HttpApiEndpoint.delete("shell.remove", "/api/shell/:id", {
|
|
54
|
+
params: { id: Shell.ID },
|
|
55
|
+
query: LocationQuery,
|
|
56
|
+
success: HttpApiSchema.NoContent,
|
|
57
|
+
})
|
|
58
|
+
.annotateMerge(locationQueryOpenApi)
|
|
59
|
+
.annotateMerge(OpenApi.annotations({
|
|
60
|
+
identifier: "shell.remove",
|
|
61
|
+
summary: "Remove shell command",
|
|
62
|
+
description: "Terminate and remove one shell command and its retained output.",
|
|
63
|
+
})))
|
|
64
|
+
.annotateMerge(OpenApi.annotations({ title: "shell", description: "Location-scoped shell command routes." }));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
|
|
3
|
+
export declare const SkillGroup: HttpApiGroup.HttpApiGroup<"server.skill", HttpApiEndpoint.HttpApiEndpoint<"skill.list", "GET", "/api/skill", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
4
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
5
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
6
|
+
}>>;
|
|
7
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
8
|
+
readonly location: Schema.Struct<{
|
|
9
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
10
|
+
}>;
|
|
11
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
12
|
+
readonly id: Schema.brand<Schema.String, "Skill.ID">;
|
|
13
|
+
readonly name: Schema.brand<Schema.String, "Skill.Name">;
|
|
14
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
15
|
+
readonly autoinvoke: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
16
|
+
readonly path: Schema.brand<Schema.String, "AbsolutePath">;
|
|
17
|
+
readonly content: Schema.String;
|
|
18
|
+
}>>;
|
|
19
|
+
}>>, never, never, never>, false>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Skill } from "@opencode/schema/skill";
|
|
2
|
+
import { Location } from "@opencode/schema/location";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
|
|
5
|
+
import { LocationQuery, locationQueryOpenApi } from "./location.js";
|
|
6
|
+
export const SkillGroup = HttpApiGroup.make("server.skill")
|
|
7
|
+
.add(HttpApiEndpoint.get("skill.list", "/api/skill", {
|
|
8
|
+
query: LocationQuery,
|
|
9
|
+
success: Location.response(Schema.Array(Skill.Info)),
|
|
10
|
+
})
|
|
11
|
+
.annotateMerge(locationQueryOpenApi)
|
|
12
|
+
.annotateMerge(OpenApi.annotations({
|
|
13
|
+
identifier: "skill.list",
|
|
14
|
+
summary: "List skills",
|
|
15
|
+
description: "Retrieve currently registered skills.",
|
|
16
|
+
})))
|
|
17
|
+
.annotateMerge(OpenApi.annotations({
|
|
18
|
+
title: "skill",
|
|
19
|
+
description: "Experimental skill routes.",
|
|
20
|
+
}));
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
|
|
3
|
+
import { ConflictError, InvalidRequestError, ServiceUnavailableError } from "../errors.js";
|
|
4
|
+
declare const VcsInitNotSupportedError_base: Schema.Class<VcsInitNotSupportedError, Schema.TaggedStruct<"VcsInitNotSupportedError", {
|
|
5
|
+
readonly providerID: Schema.String;
|
|
6
|
+
readonly message: Schema.String;
|
|
7
|
+
}>, import("effect/Cause").YieldableError>;
|
|
8
|
+
export declare class VcsInitNotSupportedError extends VcsInitNotSupportedError_base {
|
|
9
|
+
}
|
|
10
|
+
export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEndpoint.HttpApiEndpoint<"vcs.base", "GET", "/api/vcs/base", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
11
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
12
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
13
|
+
}>>;
|
|
14
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
15
|
+
readonly location: Schema.Struct<{
|
|
16
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
17
|
+
}>;
|
|
18
|
+
readonly data: Schema.NullOr<Schema.Struct<{
|
|
19
|
+
readonly name: Schema.String;
|
|
20
|
+
readonly ref: Schema.String;
|
|
21
|
+
readonly source: Schema.Literals<readonly ["reflog", "default"]>;
|
|
22
|
+
}>>;
|
|
23
|
+
}>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.branch.list", "GET", "/api/vcs/branch", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
24
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
25
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
26
|
+
}>>;
|
|
27
|
+
readonly search: Schema.optional<Schema.String>;
|
|
28
|
+
readonly limit: Schema.optional<Schema.compose<Schema.Int, Schema.NumberFromString>>;
|
|
29
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
30
|
+
readonly location: Schema.Struct<{
|
|
31
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
32
|
+
}>;
|
|
33
|
+
readonly data: Schema.$Array<Schema.String>;
|
|
34
|
+
}>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.diff", "GET", "/api/vcs/diff", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
35
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
36
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
37
|
+
}>>;
|
|
38
|
+
readonly mode: Schema.Literals<readonly ["working", "branch", "committed"]>;
|
|
39
|
+
readonly base: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
40
|
+
readonly context: Schema.optional<Schema.compose<Schema.Int, Schema.NumberFromString>>;
|
|
41
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
42
|
+
readonly location: Schema.Struct<{
|
|
43
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
44
|
+
}>;
|
|
45
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
46
|
+
readonly file: Schema.String;
|
|
47
|
+
readonly patch: Schema.String;
|
|
48
|
+
readonly additions: Schema.Int;
|
|
49
|
+
readonly deletions: Schema.Int;
|
|
50
|
+
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
51
|
+
}>>;
|
|
52
|
+
}>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.get", "GET", "/api/vcs", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
53
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
54
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
55
|
+
}>>;
|
|
56
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
57
|
+
readonly location: Schema.Struct<{
|
|
58
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
59
|
+
}>;
|
|
60
|
+
readonly data: Schema.Struct<{
|
|
61
|
+
readonly provider: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
62
|
+
readonly branch: Schema.Struct<{
|
|
63
|
+
readonly current: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
64
|
+
readonly default: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
65
|
+
}>;
|
|
66
|
+
}>;
|
|
67
|
+
}>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.init", "POST", "/api/vcs/init", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
68
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
69
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
70
|
+
}>>;
|
|
71
|
+
readonly provider: Schema.optional<Schema.String>;
|
|
72
|
+
}>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof InvalidRequestError | typeof ConflictError | typeof ServiceUnavailableError | typeof VcsInitNotSupportedError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.status", "GET", "/api/vcs/status", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
73
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
74
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
75
|
+
}>>;
|
|
76
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
77
|
+
readonly location: Schema.Struct<{
|
|
78
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
79
|
+
}>;
|
|
80
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
81
|
+
readonly file: Schema.String;
|
|
82
|
+
readonly additions: Schema.Int;
|
|
83
|
+
readonly deletions: Schema.Int;
|
|
84
|
+
readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
|
|
85
|
+
}>>;
|
|
86
|
+
}>>, never, never, never>, false>;
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { FileDiff } from "@opencode/schema/file-diff";
|
|
2
|
+
import { Location } from "@opencode/schema/location";
|
|
3
|
+
import { NonNegativeInt, PositiveInt, optional } from "@opencode/schema/schema";
|
|
4
|
+
import { Vcs } from "@opencode/schema/vcs";
|
|
5
|
+
import { Schema } from "effect";
|
|
6
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
7
|
+
import { LocationQuery, locationQueryOpenApi } from "./location.js";
|
|
8
|
+
import { ConflictError, InvalidRequestError, ServiceUnavailableError } from "../errors.js";
|
|
9
|
+
const InitQuery = Schema.Struct({
|
|
10
|
+
...LocationQuery.fields,
|
|
11
|
+
provider: Schema.optional(Schema.String),
|
|
12
|
+
});
|
|
13
|
+
export class VcsInitNotSupportedError extends Schema.TaggedError()("VcsInitNotSupportedError", { providerID: Schema.String, message: Schema.String }, { httpApiStatus: 501 }) {
|
|
14
|
+
}
|
|
15
|
+
const BranchesQuery = Schema.Struct({
|
|
16
|
+
...LocationQuery.fields,
|
|
17
|
+
search: Schema.optional(Schema.String),
|
|
18
|
+
limit: Schema.NumberFromString.pipe(Schema.decodeTo(PositiveInt), Schema.optional),
|
|
19
|
+
});
|
|
20
|
+
const DiffQuery = Schema.Struct({
|
|
21
|
+
...LocationQuery.fields,
|
|
22
|
+
mode: Vcs.Mode,
|
|
23
|
+
base: optional(Schema.String),
|
|
24
|
+
context: Schema.NumberFromString.pipe(Schema.decodeTo(NonNegativeInt), Schema.optional),
|
|
25
|
+
});
|
|
26
|
+
export const VcsGroup = HttpApiGroup.make("server.vcs")
|
|
27
|
+
.add(HttpApiEndpoint.post("vcs.init", "/api/vcs/init", {
|
|
28
|
+
query: InitQuery,
|
|
29
|
+
success: HttpApiSchema.NoContent,
|
|
30
|
+
error: [ConflictError, InvalidRequestError, VcsInitNotSupportedError, ServiceUnavailableError],
|
|
31
|
+
})
|
|
32
|
+
.annotateMerge(locationQueryOpenApi)
|
|
33
|
+
.annotateMerge(OpenApi.annotations({
|
|
34
|
+
identifier: "vcs.init",
|
|
35
|
+
summary: "Initialize VCS repository",
|
|
36
|
+
description: "Initialize a repository using the selected VCS provider in a markerless project's directory and refresh its location services. Omitting provider defaults to git; built-in git and hg providers support initialization. An unknown provider returns 400; a registered provider without init returns 501.",
|
|
37
|
+
})))
|
|
38
|
+
.add(HttpApiEndpoint.get("vcs.get", "/api/vcs", {
|
|
39
|
+
query: LocationQuery,
|
|
40
|
+
success: Location.response(Vcs.Info),
|
|
41
|
+
})
|
|
42
|
+
.annotateMerge(locationQueryOpenApi)
|
|
43
|
+
.annotateMerge(OpenApi.annotations({
|
|
44
|
+
identifier: "vcs.get",
|
|
45
|
+
summary: "VCS info",
|
|
46
|
+
description: "Get current and default branch information for the requested location.",
|
|
47
|
+
})))
|
|
48
|
+
.add(HttpApiEndpoint.get("vcs.base", "/api/vcs/base", {
|
|
49
|
+
query: LocationQuery,
|
|
50
|
+
success: Location.response(Schema.NullOr(Vcs.Base)),
|
|
51
|
+
error: ServiceUnavailableError,
|
|
52
|
+
})
|
|
53
|
+
.annotateMerge(locationQueryOpenApi)
|
|
54
|
+
.annotateMerge(OpenApi.annotations({
|
|
55
|
+
identifier: "vcs.base",
|
|
56
|
+
summary: "VCS review base",
|
|
57
|
+
description: "Infer a local review base from named branch creation history, or the repository default only when currently on that branch. Returns null before the first commit or when the provider lacks base metadata; ambiguous Git history requires an explicit base on diff requests.",
|
|
58
|
+
})))
|
|
59
|
+
.add(HttpApiEndpoint.get("vcs.status", "/api/vcs/status", {
|
|
60
|
+
query: LocationQuery,
|
|
61
|
+
success: Location.response(Schema.Array(Vcs.FileStatus)),
|
|
62
|
+
})
|
|
63
|
+
.annotateMerge(locationQueryOpenApi)
|
|
64
|
+
.annotateMerge(OpenApi.annotations({
|
|
65
|
+
identifier: "vcs.status",
|
|
66
|
+
summary: "VCS status",
|
|
67
|
+
description: "List uncommitted working-copy changes relative to the requested location.",
|
|
68
|
+
})))
|
|
69
|
+
.add(HttpApiEndpoint.get("vcs.branch.list", "/api/vcs/branch", {
|
|
70
|
+
query: BranchesQuery,
|
|
71
|
+
success: Location.response(Vcs.BranchList),
|
|
72
|
+
})
|
|
73
|
+
.annotateMerge(locationQueryOpenApi)
|
|
74
|
+
.annotateMerge(OpenApi.annotations({
|
|
75
|
+
identifier: "vcs.branch.list",
|
|
76
|
+
summary: "VCS branches",
|
|
77
|
+
description: "List local and remote branches available at the requested location.",
|
|
78
|
+
})))
|
|
79
|
+
.add(HttpApiEndpoint.get("vcs.diff", "/api/vcs/diff", {
|
|
80
|
+
query: DiffQuery,
|
|
81
|
+
success: Location.response(Schema.Array(FileDiff.Info)),
|
|
82
|
+
error: ServiceUnavailableError,
|
|
83
|
+
})
|
|
84
|
+
.annotateMerge(locationQueryOpenApi)
|
|
85
|
+
.annotateMerge(OpenApi.annotations({
|
|
86
|
+
identifier: "vcs.diff",
|
|
87
|
+
summary: "VCS diff",
|
|
88
|
+
description: "Diff HEAD to the working copy (working), the base merge-base to the working copy (branch), or the base merge-base to HEAD (committed). Omitting base preserves repository-default comparison; supplying it overrides the comparison without saving it.",
|
|
89
|
+
})))
|
|
90
|
+
.annotateMerge(OpenApi.annotations({
|
|
91
|
+
title: "vcs",
|
|
92
|
+
description: "Location-scoped version control routes.",
|
|
93
|
+
}));
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
|
|
3
|
+
import { InvalidRequestError, LocationNotFoundError, ServiceUnavailableError } from "../errors.js";
|
|
4
|
+
export declare const VoiceTransportType: Schema.Literals<readonly ["webrtc", "websocket"]>;
|
|
5
|
+
export declare const VoiceModel: Schema.Struct<{
|
|
6
|
+
readonly model: Schema.String;
|
|
7
|
+
readonly provider: Schema.String;
|
|
8
|
+
readonly transports: Schema.$Array<Schema.Literals<readonly ["webrtc", "websocket"]>>;
|
|
9
|
+
readonly available: Schema.Boolean;
|
|
10
|
+
/** The integration whose connection starts its sessions: the provider's stored key, or `opencode` when the connected OpenCode Console hosts it. */
|
|
11
|
+
readonly integration: Schema.optional<Schema.String>;
|
|
12
|
+
/** The OpenCode Console workspace a hosted model's sessions bill to. */
|
|
13
|
+
readonly workspace: Schema.optional<Schema.String>;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const VoiceWebRTCTransportInput: Schema.Struct<{
|
|
16
|
+
readonly type: Schema.Literal<"webrtc">;
|
|
17
|
+
readonly sdp: Schema.String;
|
|
18
|
+
readonly dcid: Schema.optional<Schema.Number>;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const VoiceWebSocketTransportInput: Schema.Struct<{
|
|
21
|
+
readonly type: Schema.Literal<"websocket">;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const VoiceTransportInput: Schema.Union<readonly [Schema.Struct<{
|
|
24
|
+
readonly type: Schema.Literal<"webrtc">;
|
|
25
|
+
readonly sdp: Schema.String;
|
|
26
|
+
readonly dcid: Schema.optional<Schema.Number>;
|
|
27
|
+
}>, Schema.Struct<{
|
|
28
|
+
readonly type: Schema.Literal<"websocket">;
|
|
29
|
+
}>]>;
|
|
30
|
+
export declare const VoiceWebRTCTransport: Schema.Struct<{
|
|
31
|
+
readonly type: Schema.Literal<"webrtc">;
|
|
32
|
+
readonly sdp: Schema.String;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const VoiceWebSocketTransport: Schema.Struct<{
|
|
35
|
+
readonly type: Schema.Literal<"websocket">;
|
|
36
|
+
readonly url: Schema.String;
|
|
37
|
+
readonly token: Schema.String;
|
|
38
|
+
readonly expiresAt: Schema.Number;
|
|
39
|
+
}>;
|
|
40
|
+
export declare const VoiceTransport: Schema.Union<readonly [Schema.Struct<{
|
|
41
|
+
readonly type: Schema.Literal<"webrtc">;
|
|
42
|
+
readonly sdp: Schema.String;
|
|
43
|
+
}>, Schema.Struct<{
|
|
44
|
+
readonly type: Schema.Literal<"websocket">;
|
|
45
|
+
readonly url: Schema.String;
|
|
46
|
+
readonly token: Schema.String;
|
|
47
|
+
readonly expiresAt: Schema.Number;
|
|
48
|
+
}>]>;
|
|
49
|
+
export declare const VoiceGroup: HttpApiGroup.HttpApiGroup<"server.voice", HttpApiEndpoint.HttpApiEndpoint<"voice.instructions", "POST", "/api/experimental/voice/session/:sessionID/instructions", Schema.toCodecStringTree<Schema.Struct<{
|
|
50
|
+
sessionID: Schema.String;
|
|
51
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
52
|
+
readonly instructions: Schema.String;
|
|
53
|
+
}>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"voice.models", "GET", "/api/experimental/voice/models", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
54
|
+
readonly data: Schema.Struct<{
|
|
55
|
+
readonly models: Schema.$Array<Schema.Struct<{
|
|
56
|
+
readonly model: Schema.String;
|
|
57
|
+
readonly provider: Schema.String;
|
|
58
|
+
readonly transports: Schema.$Array<Schema.Literals<readonly ["webrtc", "websocket"]>>;
|
|
59
|
+
readonly available: Schema.Boolean;
|
|
60
|
+
/** The integration whose connection starts its sessions: the provider's stored key, or `opencode` when the connected OpenCode Console hosts it. */
|
|
61
|
+
readonly integration: Schema.optional<Schema.String>;
|
|
62
|
+
/** The OpenCode Console workspace a hosted model's sessions bill to. */
|
|
63
|
+
readonly workspace: Schema.optional<Schema.String>;
|
|
64
|
+
}>>;
|
|
65
|
+
readonly default: Schema.optional<Schema.String>;
|
|
66
|
+
}>;
|
|
67
|
+
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"voice.session", "POST", "/api/experimental/voice/session", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
68
|
+
readonly model: Schema.String;
|
|
69
|
+
readonly session: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
70
|
+
readonly transport: Schema.Union<readonly [Schema.Struct<{
|
|
71
|
+
readonly type: Schema.Literal<"webrtc">;
|
|
72
|
+
readonly sdp: Schema.String;
|
|
73
|
+
readonly dcid: Schema.optional<Schema.Number>;
|
|
74
|
+
}>, Schema.Struct<{
|
|
75
|
+
readonly type: Schema.Literal<"websocket">;
|
|
76
|
+
}>]>;
|
|
77
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
78
|
+
readonly data: Schema.Struct<{
|
|
79
|
+
readonly transport: Schema.Union<readonly [Schema.Struct<{
|
|
80
|
+
readonly type: Schema.Literal<"webrtc">;
|
|
81
|
+
readonly sdp: Schema.String;
|
|
82
|
+
}>, Schema.Struct<{
|
|
83
|
+
readonly type: Schema.Literal<"websocket">;
|
|
84
|
+
readonly url: Schema.String;
|
|
85
|
+
readonly token: Schema.String;
|
|
86
|
+
readonly expiresAt: Schema.Number;
|
|
87
|
+
}>]>;
|
|
88
|
+
/** A hosted session's ID, for `voice.instructions`. */
|
|
89
|
+
readonly session: Schema.optional<Schema.Struct<{
|
|
90
|
+
readonly id: Schema.String;
|
|
91
|
+
}>>;
|
|
92
|
+
}>;
|
|
93
|
+
}>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never>, false>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
|
|
3
|
+
import { InvalidRequestError, LocationNotFoundError, ServiceUnavailableError } from "../errors.js";
|
|
4
|
+
export const VoiceTransportType = Schema.Literals(["webrtc", "websocket"]).annotate({
|
|
5
|
+
identifier: "VoiceTransportType",
|
|
6
|
+
});
|
|
7
|
+
export const VoiceModel = Schema.Struct({
|
|
8
|
+
model: Schema.String,
|
|
9
|
+
provider: Schema.String,
|
|
10
|
+
transports: Schema.Array(VoiceTransportType),
|
|
11
|
+
available: Schema.Boolean,
|
|
12
|
+
/** The integration whose connection starts its sessions: the provider's stored key, or `opencode` when the connected OpenCode Console hosts it. */
|
|
13
|
+
integration: Schema.optional(Schema.String),
|
|
14
|
+
/** The OpenCode Console workspace a hosted model's sessions bill to. */
|
|
15
|
+
workspace: Schema.optional(Schema.String),
|
|
16
|
+
}).annotate({ identifier: "VoiceModel" });
|
|
17
|
+
export const VoiceWebRTCTransportInput = Schema.Struct({
|
|
18
|
+
type: Schema.Literal("webrtc"),
|
|
19
|
+
sdp: Schema.String,
|
|
20
|
+
dcid: Schema.optional(Schema.Number),
|
|
21
|
+
}).annotate({ identifier: "VoiceWebRTCTransportInput" });
|
|
22
|
+
export const VoiceWebSocketTransportInput = Schema.Struct({
|
|
23
|
+
type: Schema.Literal("websocket"),
|
|
24
|
+
}).annotate({ identifier: "VoiceWebSocketTransportInput" });
|
|
25
|
+
export const VoiceTransportInput = Schema.Union([
|
|
26
|
+
VoiceWebRTCTransportInput,
|
|
27
|
+
VoiceWebSocketTransportInput,
|
|
28
|
+
]).annotate({ identifier: "VoiceTransportInput" });
|
|
29
|
+
export const VoiceWebRTCTransport = Schema.Struct({
|
|
30
|
+
type: Schema.Literal("webrtc"),
|
|
31
|
+
sdp: Schema.String,
|
|
32
|
+
}).annotate({ identifier: "VoiceWebRTCTransport" });
|
|
33
|
+
export const VoiceWebSocketTransport = Schema.Struct({
|
|
34
|
+
type: Schema.Literal("websocket"),
|
|
35
|
+
url: Schema.String,
|
|
36
|
+
token: Schema.String,
|
|
37
|
+
expiresAt: Schema.Number,
|
|
38
|
+
}).annotate({ identifier: "VoiceWebSocketTransport" });
|
|
39
|
+
export const VoiceTransport = Schema.Union([
|
|
40
|
+
VoiceWebRTCTransport,
|
|
41
|
+
VoiceWebSocketTransport,
|
|
42
|
+
]).annotate({ identifier: "VoiceTransport" });
|
|
43
|
+
export const VoiceGroup = HttpApiGroup.make("server.voice")
|
|
44
|
+
.add(HttpApiEndpoint.get("voice.models", "/api/experimental/voice/models", {
|
|
45
|
+
success: Schema.Struct({
|
|
46
|
+
data: Schema.Struct({
|
|
47
|
+
models: Schema.Array(VoiceModel),
|
|
48
|
+
default: Schema.optional(Schema.String),
|
|
49
|
+
}),
|
|
50
|
+
}).annotate({ identifier: "VoiceModelsResponse" }),
|
|
51
|
+
error: [ServiceUnavailableError, LocationNotFoundError],
|
|
52
|
+
}).annotateMerge(OpenApi.annotations({
|
|
53
|
+
identifier: "experimental.voice.models",
|
|
54
|
+
summary: "List voice models",
|
|
55
|
+
description: "List supported voice models, their transports, whether the server has a usable API key for each provider or the connected OpenCode Console hosts the model, and the Console workspace a hosted model bills to.",
|
|
56
|
+
})))
|
|
57
|
+
.add(HttpApiEndpoint.post("voice.session", "/api/experimental/voice/session", {
|
|
58
|
+
payload: Schema.Struct({
|
|
59
|
+
model: Schema.String,
|
|
60
|
+
session: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
61
|
+
transport: VoiceTransportInput,
|
|
62
|
+
}),
|
|
63
|
+
success: Schema.Struct({
|
|
64
|
+
data: Schema.Struct({
|
|
65
|
+
transport: VoiceTransport,
|
|
66
|
+
/** A hosted session's ID, for `voice.instructions`. */
|
|
67
|
+
session: Schema.optional(Schema.Struct({ id: Schema.String })),
|
|
68
|
+
}),
|
|
69
|
+
}).annotate({ identifier: "VoiceSessionResponse" }),
|
|
70
|
+
error: [InvalidRequestError, ServiceUnavailableError, LocationNotFoundError],
|
|
71
|
+
}).annotateMerge(OpenApi.annotations({
|
|
72
|
+
identifier: "experimental.voice.session",
|
|
73
|
+
summary: "Create voice session",
|
|
74
|
+
description: "Create a server-brokered voice session using the server's configured provider credentials, or the connected OpenCode Console when it hosts the model, and return the WebRTC SDP answer or WebSocket ephemeral token.",
|
|
75
|
+
})))
|
|
76
|
+
.add(HttpApiEndpoint.post("voice.instructions", "/api/experimental/voice/session/:sessionID/instructions", {
|
|
77
|
+
params: { sessionID: Schema.String },
|
|
78
|
+
payload: Schema.Struct({ instructions: Schema.String }),
|
|
79
|
+
success: HttpApiSchema.NoContent,
|
|
80
|
+
error: [InvalidRequestError, ServiceUnavailableError, LocationNotFoundError],
|
|
81
|
+
}).annotateMerge(OpenApi.annotations({
|
|
82
|
+
identifier: "experimental.voice.instructions",
|
|
83
|
+
summary: "Replace voice session instructions",
|
|
84
|
+
description: "Replace the backend instructions of a running session the connected OpenCode Console hosts, whose data channel can't change them.",
|
|
85
|
+
})))
|
|
86
|
+
.annotateMerge(OpenApi.annotations({
|
|
87
|
+
title: "voice",
|
|
88
|
+
description: "Experimental server-brokered voice session routes.",
|
|
89
|
+
}));
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { WebSearch } from "@opencode/schema/websearch";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { HttpApiEndpoint, HttpApiGroup } from "effect/http-api";
|
|
4
|
+
import { InvalidRequestError, ServiceUnavailableError } from "../errors.js";
|
|
5
|
+
export declare const WebSearchGroup: HttpApiGroup.HttpApiGroup<"server.websearch", HttpApiEndpoint.HttpApiEndpoint<"websearch.providers", "GET", "/api/websearch/provider", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
6
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
7
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
8
|
+
}>>;
|
|
9
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
10
|
+
readonly location: Schema.Struct<{
|
|
11
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
12
|
+
}>;
|
|
13
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
14
|
+
readonly id: Schema.brand<Schema.String, "WebSearch.ID">;
|
|
15
|
+
readonly name: Schema.String;
|
|
16
|
+
}>>;
|
|
17
|
+
}>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"websearch.query", "POST", "/api/websearch", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
18
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
19
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
20
|
+
}>>;
|
|
21
|
+
}>>, Schema.toCodecJson<Schema.Struct<{
|
|
22
|
+
readonly query: Schema.String;
|
|
23
|
+
readonly providerID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WebSearch.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "WebSearch.ID">>, never, never>;
|
|
24
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
25
|
+
readonly location: Schema.Struct<{
|
|
26
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
27
|
+
}>;
|
|
28
|
+
readonly data: typeof WebSearch.Response;
|
|
29
|
+
}>>, Schema.toCodecJson<typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never>, false>;
|