@opencode-ai/protocol 0.0.0-dev-17471
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 +53 -0
- package/dist/api.js +73 -0
- package/dist/client.d.ts +61 -0
- package/dist/client.js +47 -0
- package/dist/errors.d.ts +133 -0
- package/dist/errors.js +105 -0
- package/dist/groups/agent.d.ts +194 -0
- package/dist/groups/agent.js +30 -0
- package/dist/groups/command.d.ts +63 -0
- package/dist/groups/command.js +20 -0
- package/dist/groups/config.d.ts +9 -0
- package/dist/groups/config.js +16 -0
- package/dist/groups/credential.d.ts +23 -0
- package/dist/groups/credential.js +29 -0
- package/dist/groups/debug.d.ts +17 -0
- package/dist/groups/debug.js +23 -0
- package/dist/groups/event.d.ts +12882 -0
- package/dist/groups/event.js +42 -0
- package/dist/groups/form.d.ts +781 -0
- package/dist/groups/form.js +97 -0
- package/dist/groups/fs.d.ts +35 -0
- package/dist/groups/fs.js +51 -0
- package/dist/groups/generate.d.ts +38 -0
- package/dist/groups/generate.js +27 -0
- package/dist/groups/health.d.ts +27 -0
- package/dist/groups/health.js +34 -0
- package/dist/groups/integration.d.ts +1152 -0
- package/dist/groups/integration.js +149 -0
- package/dist/groups/location.d.ts +16 -0
- package/dist/groups/location.js +34 -0
- package/dist/groups/mcp.d.ts +82 -0
- package/dist/groups/mcp.js +78 -0
- package/dist/groups/message.d.ts +592 -0
- package/dist/groups/message.js +37 -0
- package/dist/groups/migration.d.ts +28 -0
- package/dist/groups/migration.js +21 -0
- package/dist/groups/model.d.ts +218 -0
- package/dist/groups/model.js +33 -0
- package/dist/groups/permission.d.ts +153 -0
- package/dist/groups/permission.js +99 -0
- package/dist/groups/plugin.d.ts +14 -0
- package/dist/groups/plugin.js +20 -0
- package/dist/groups/project.d.ts +41 -0
- package/dist/groups/project.js +27 -0
- package/dist/groups/provider.d.ts +82 -0
- package/dist/groups/provider.js +34 -0
- package/dist/groups/pty.d.ts +145 -0
- package/dist/groups/pty.js +112 -0
- package/dist/groups/reference.d.ts +29 -0
- package/dist/groups/reference.js +20 -0
- package/dist/groups/server.d.ts +5 -0
- package/dist/groups/server.js +11 -0
- package/dist/groups/session.d.ts +9247 -0
- package/dist/groups/session.js +515 -0
- package/dist/groups/shell.d.ts +152 -0
- package/dist/groups/shell.js +82 -0
- package/dist/groups/skill.d.ts +20 -0
- package/dist/groups/skill.js +20 -0
- package/dist/groups/vcs.d.ts +46 -0
- package/dist/groups/vcs.js +47 -0
- package/dist/groups/websearch.d.ts +28 -0
- package/dist/groups/websearch.js +34 -0
- package/dist/groups/worktree.d.ts +42 -0
- package/dist/groups/worktree.js +54 -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 +1590 -0
- package/dist/simulation.js +460 -0
- package/package.json +44 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
3
|
+
export declare const V1MigrationStatus: Schema.Union<readonly [Schema.Struct<{
|
|
4
|
+
readonly status: Schema.Literals<readonly ["required", "completed"]>;
|
|
5
|
+
}>, Schema.Struct<{
|
|
6
|
+
readonly status: Schema.Literal<"running">;
|
|
7
|
+
readonly progress: Schema.Struct<{
|
|
8
|
+
readonly label: Schema.String;
|
|
9
|
+
readonly numerator: Schema.optional<Schema.Int>;
|
|
10
|
+
readonly denominator: Schema.optional<Schema.Int>;
|
|
11
|
+
}>;
|
|
12
|
+
}>, Schema.Struct<{
|
|
13
|
+
readonly status: Schema.Literal<"error">;
|
|
14
|
+
readonly error: Schema.String;
|
|
15
|
+
}>]>;
|
|
16
|
+
export declare const MigrationGroup: HttpApiGroup.HttpApiGroup<"server.migration", HttpApiEndpoint.HttpApiEndpoint<"migration.v1.status", "GET", "/api/experimental/migration/v1", never, never, never, never, Schema.toCodecJson<Schema.Union<readonly [Schema.Struct<{
|
|
17
|
+
readonly status: Schema.Literals<readonly ["required", "completed"]>;
|
|
18
|
+
}>, Schema.Struct<{
|
|
19
|
+
readonly status: Schema.Literal<"running">;
|
|
20
|
+
readonly progress: Schema.Struct<{
|
|
21
|
+
readonly label: Schema.String;
|
|
22
|
+
readonly numerator: Schema.optional<Schema.Int>;
|
|
23
|
+
readonly denominator: Schema.optional<Schema.Int>;
|
|
24
|
+
}>;
|
|
25
|
+
}>, Schema.Struct<{
|
|
26
|
+
readonly status: Schema.Literal<"error">;
|
|
27
|
+
readonly error: Schema.String;
|
|
28
|
+
}>]>>, never, never, never>, false>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
|
|
3
|
+
const V1MigrationProgress = Schema.Struct({
|
|
4
|
+
label: Schema.String,
|
|
5
|
+
numerator: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
|
|
6
|
+
denominator: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))),
|
|
7
|
+
});
|
|
8
|
+
export const V1MigrationStatus = Schema.Union([
|
|
9
|
+
Schema.Struct({ status: Schema.Literals(["required", "completed"]) }),
|
|
10
|
+
Schema.Struct({ status: Schema.Literal("running"), progress: V1MigrationProgress }),
|
|
11
|
+
Schema.Struct({ status: Schema.Literal("error"), error: Schema.String }),
|
|
12
|
+
]);
|
|
13
|
+
export const MigrationGroup = HttpApiGroup.make("server.migration")
|
|
14
|
+
.add(HttpApiEndpoint.get("migration.v1.status", "/api/experimental/migration/v1", {
|
|
15
|
+
success: V1MigrationStatus,
|
|
16
|
+
}).annotateMerge(OpenApi.annotations({
|
|
17
|
+
identifier: "v2.experimental.migration.v1.status",
|
|
18
|
+
summary: "Get V1 migration status",
|
|
19
|
+
description: "Return the progress of the V1 to V2 session history migration.",
|
|
20
|
+
})))
|
|
21
|
+
.annotateMerge(OpenApi.annotations({ title: "migration" }));
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { Model } from "@opencode-ai/schema/model";
|
|
2
|
+
import { Location } from "@opencode-ai/schema/location";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
5
|
+
import { ServiceUnavailableError } from "../errors.js";
|
|
6
|
+
export declare const ModelGroup: HttpApiGroup.HttpApiGroup<"server.model", HttpApiEndpoint.HttpApiEndpoint<"model.list", "GET", "/api/model", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
7
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
8
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
9
|
+
readonly workspace: Schema.optional<Schema.String>;
|
|
10
|
+
}>>;
|
|
11
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
12
|
+
readonly location: typeof Location.Info;
|
|
13
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
14
|
+
readonly capabilities: Schema.Struct<{
|
|
15
|
+
readonly tools: Schema.Boolean;
|
|
16
|
+
readonly input: Schema.$Array<Schema.String>;
|
|
17
|
+
readonly output: Schema.$Array<Schema.String>;
|
|
18
|
+
}>;
|
|
19
|
+
readonly variants: Schema.$Array<Schema.Struct<{
|
|
20
|
+
readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
|
|
21
|
+
readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
22
|
+
readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
|
|
23
|
+
readonly id: Schema.brand<Schema.String, "Model.VariantID">;
|
|
24
|
+
}>>;
|
|
25
|
+
readonly time: Schema.Struct<{
|
|
26
|
+
readonly released: Schema.Finite;
|
|
27
|
+
}>;
|
|
28
|
+
readonly cost: Schema.$Array<Schema.Struct<{
|
|
29
|
+
readonly tier: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
30
|
+
readonly type: Schema.tag<"context">;
|
|
31
|
+
readonly size: Schema.Int;
|
|
32
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
33
|
+
readonly type: Schema.tag<"context">;
|
|
34
|
+
readonly size: Schema.Int;
|
|
35
|
+
}>>, never, never>;
|
|
36
|
+
readonly input: Schema.brand<Schema.Finite, "Money.USDPerMillionTokens"> & {
|
|
37
|
+
zero: number & import("effect/Brand").Brand<"Money.USDPerMillionTokens">;
|
|
38
|
+
};
|
|
39
|
+
readonly output: Schema.brand<Schema.Finite, "Money.USDPerMillionTokens"> & {
|
|
40
|
+
zero: number & import("effect/Brand").Brand<"Money.USDPerMillionTokens">;
|
|
41
|
+
};
|
|
42
|
+
readonly cache: Schema.Struct<{
|
|
43
|
+
readonly read: Schema.brand<Schema.Finite, "Money.USDPerMillionTokens"> & {
|
|
44
|
+
zero: number & import("effect/Brand").Brand<"Money.USDPerMillionTokens">;
|
|
45
|
+
};
|
|
46
|
+
readonly write: Schema.brand<Schema.Finite, "Money.USDPerMillionTokens"> & {
|
|
47
|
+
zero: number & import("effect/Brand").Brand<"Money.USDPerMillionTokens">;
|
|
48
|
+
};
|
|
49
|
+
}>;
|
|
50
|
+
}>>;
|
|
51
|
+
readonly status: Schema.Literals<readonly ["alpha", "beta", "deprecated", "active"]>;
|
|
52
|
+
readonly enabled: Schema.Boolean;
|
|
53
|
+
readonly limit: Schema.Struct<{
|
|
54
|
+
readonly context: Schema.Int;
|
|
55
|
+
readonly input: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
56
|
+
readonly output: Schema.Int;
|
|
57
|
+
}>;
|
|
58
|
+
readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
|
|
59
|
+
readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
60
|
+
readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
|
|
61
|
+
readonly id: Schema.brand<Schema.String, "Model.ID">;
|
|
62
|
+
readonly modelID: Schema.brand<Schema.String, "Model.ID">;
|
|
63
|
+
readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
|
|
64
|
+
opencode: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
65
|
+
anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
66
|
+
openai: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
67
|
+
google: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
68
|
+
googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
69
|
+
githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
70
|
+
amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
71
|
+
azure: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
72
|
+
openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
73
|
+
mistral: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
74
|
+
gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
75
|
+
};
|
|
76
|
+
readonly family: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.Family">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.Family">>, never, never>;
|
|
77
|
+
readonly name: Schema.String;
|
|
78
|
+
readonly compatibility: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
79
|
+
readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>, never, never>;
|
|
80
|
+
readonly maxTokensField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>>, Schema.optionalKey<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>, never, never>;
|
|
81
|
+
readonly requireFinishReason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
82
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
83
|
+
readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>, never, never>;
|
|
84
|
+
readonly maxTokensField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>>, Schema.optionalKey<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>, never, never>;
|
|
85
|
+
readonly requireFinishReason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
86
|
+
}>>, never, never>;
|
|
87
|
+
readonly package: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
88
|
+
}> & {
|
|
89
|
+
default: (providerID: import("@opencode-ai/schema/provider").ID, id: Model.ID) => {
|
|
90
|
+
id: string & import("effect/Brand").Brand<"Model.ID">;
|
|
91
|
+
modelID: string & import("effect/Brand").Brand<"Model.ID">;
|
|
92
|
+
providerID: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
93
|
+
name: string & import("effect/Brand").Brand<"Model.ID">;
|
|
94
|
+
capabilities: {
|
|
95
|
+
tools: true;
|
|
96
|
+
input: string[];
|
|
97
|
+
output: string[];
|
|
98
|
+
};
|
|
99
|
+
variants: never[];
|
|
100
|
+
time: {
|
|
101
|
+
released: number;
|
|
102
|
+
};
|
|
103
|
+
cost: never[];
|
|
104
|
+
status: "active";
|
|
105
|
+
enabled: true;
|
|
106
|
+
limit: {
|
|
107
|
+
context: number;
|
|
108
|
+
output: number;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
}>;
|
|
112
|
+
}>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"model.default", "GET", "/api/model/default", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
113
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
114
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
115
|
+
readonly workspace: Schema.optional<Schema.String>;
|
|
116
|
+
}>>;
|
|
117
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
118
|
+
readonly location: typeof Location.Info;
|
|
119
|
+
readonly data: Schema.UndefinedOr<Schema.Struct<{
|
|
120
|
+
readonly capabilities: Schema.Struct<{
|
|
121
|
+
readonly tools: Schema.Boolean;
|
|
122
|
+
readonly input: Schema.$Array<Schema.String>;
|
|
123
|
+
readonly output: Schema.$Array<Schema.String>;
|
|
124
|
+
}>;
|
|
125
|
+
readonly variants: Schema.$Array<Schema.Struct<{
|
|
126
|
+
readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
|
|
127
|
+
readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
128
|
+
readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
|
|
129
|
+
readonly id: Schema.brand<Schema.String, "Model.VariantID">;
|
|
130
|
+
}>>;
|
|
131
|
+
readonly time: Schema.Struct<{
|
|
132
|
+
readonly released: Schema.Finite;
|
|
133
|
+
}>;
|
|
134
|
+
readonly cost: Schema.$Array<Schema.Struct<{
|
|
135
|
+
readonly tier: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
136
|
+
readonly type: Schema.tag<"context">;
|
|
137
|
+
readonly size: Schema.Int;
|
|
138
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
139
|
+
readonly type: Schema.tag<"context">;
|
|
140
|
+
readonly size: Schema.Int;
|
|
141
|
+
}>>, never, never>;
|
|
142
|
+
readonly input: Schema.brand<Schema.Finite, "Money.USDPerMillionTokens"> & {
|
|
143
|
+
zero: number & import("effect/Brand").Brand<"Money.USDPerMillionTokens">;
|
|
144
|
+
};
|
|
145
|
+
readonly output: Schema.brand<Schema.Finite, "Money.USDPerMillionTokens"> & {
|
|
146
|
+
zero: number & import("effect/Brand").Brand<"Money.USDPerMillionTokens">;
|
|
147
|
+
};
|
|
148
|
+
readonly cache: Schema.Struct<{
|
|
149
|
+
readonly read: Schema.brand<Schema.Finite, "Money.USDPerMillionTokens"> & {
|
|
150
|
+
zero: number & import("effect/Brand").Brand<"Money.USDPerMillionTokens">;
|
|
151
|
+
};
|
|
152
|
+
readonly write: Schema.brand<Schema.Finite, "Money.USDPerMillionTokens"> & {
|
|
153
|
+
zero: number & import("effect/Brand").Brand<"Money.USDPerMillionTokens">;
|
|
154
|
+
};
|
|
155
|
+
}>;
|
|
156
|
+
}>>;
|
|
157
|
+
readonly status: Schema.Literals<readonly ["alpha", "beta", "deprecated", "active"]>;
|
|
158
|
+
readonly enabled: Schema.Boolean;
|
|
159
|
+
readonly limit: Schema.Struct<{
|
|
160
|
+
readonly context: Schema.Int;
|
|
161
|
+
readonly input: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
162
|
+
readonly output: Schema.Int;
|
|
163
|
+
}>;
|
|
164
|
+
readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
|
|
165
|
+
readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
166
|
+
readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
|
|
167
|
+
readonly id: Schema.brand<Schema.String, "Model.ID">;
|
|
168
|
+
readonly modelID: Schema.brand<Schema.String, "Model.ID">;
|
|
169
|
+
readonly providerID: Schema.brand<Schema.String, "Provider.ID"> & {
|
|
170
|
+
opencode: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
171
|
+
anthropic: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
172
|
+
openai: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
173
|
+
google: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
174
|
+
googleVertex: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
175
|
+
githubCopilot: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
176
|
+
amazonBedrock: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
177
|
+
azure: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
178
|
+
openrouter: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
179
|
+
mistral: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
180
|
+
gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
181
|
+
};
|
|
182
|
+
readonly family: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.Family">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.Family">>, never, never>;
|
|
183
|
+
readonly name: Schema.String;
|
|
184
|
+
readonly compatibility: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
185
|
+
readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>, never, never>;
|
|
186
|
+
readonly maxTokensField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>>, Schema.optionalKey<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>, never, never>;
|
|
187
|
+
readonly requireFinishReason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
188
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
189
|
+
readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>, never, never>;
|
|
190
|
+
readonly maxTokensField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>>, Schema.optionalKey<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>, never, never>;
|
|
191
|
+
readonly requireFinishReason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
192
|
+
}>>, never, never>;
|
|
193
|
+
readonly package: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
194
|
+
}> & {
|
|
195
|
+
default: (providerID: import("@opencode-ai/schema/provider").ID, id: Model.ID) => {
|
|
196
|
+
id: string & import("effect/Brand").Brand<"Model.ID">;
|
|
197
|
+
modelID: string & import("effect/Brand").Brand<"Model.ID">;
|
|
198
|
+
providerID: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
199
|
+
name: string & import("effect/Brand").Brand<"Model.ID">;
|
|
200
|
+
capabilities: {
|
|
201
|
+
tools: true;
|
|
202
|
+
input: string[];
|
|
203
|
+
output: string[];
|
|
204
|
+
};
|
|
205
|
+
variants: never[];
|
|
206
|
+
time: {
|
|
207
|
+
released: number;
|
|
208
|
+
};
|
|
209
|
+
cost: never[];
|
|
210
|
+
status: "active";
|
|
211
|
+
enabled: true;
|
|
212
|
+
limit: {
|
|
213
|
+
context: number;
|
|
214
|
+
output: number;
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
}>;
|
|
218
|
+
}>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never>, false>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Model } from "@opencode-ai/schema/model";
|
|
2
|
+
import { Location } from "@opencode-ai/schema/location";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
|
|
5
|
+
import { ServiceUnavailableError } from "../errors.js";
|
|
6
|
+
import { LocationQuery, locationQueryOpenApi } from "./location.js";
|
|
7
|
+
export const ModelGroup = HttpApiGroup.make("server.model")
|
|
8
|
+
.add(HttpApiEndpoint.get("model.list", "/api/model", {
|
|
9
|
+
query: LocationQuery,
|
|
10
|
+
success: Location.response(Schema.Array(Model.Info)),
|
|
11
|
+
error: ServiceUnavailableError,
|
|
12
|
+
})
|
|
13
|
+
.annotateMerge(locationQueryOpenApi)
|
|
14
|
+
.annotateMerge(OpenApi.annotations({
|
|
15
|
+
identifier: "v2.model.list",
|
|
16
|
+
summary: "List models",
|
|
17
|
+
description: "Retrieve the current snapshot of available models ordered by release date. The snapshot may precede initial plugin settlement.",
|
|
18
|
+
})))
|
|
19
|
+
.add(HttpApiEndpoint.get("model.default", "/api/model/default", {
|
|
20
|
+
query: LocationQuery,
|
|
21
|
+
success: Location.response(Schema.UndefinedOr(Model.Info)),
|
|
22
|
+
error: ServiceUnavailableError,
|
|
23
|
+
})
|
|
24
|
+
.annotateMerge(locationQueryOpenApi)
|
|
25
|
+
.annotateMerge(OpenApi.annotations({
|
|
26
|
+
identifier: "v2.model.default",
|
|
27
|
+
summary: "Get default model",
|
|
28
|
+
description: "Retrieve the model used when a session has no explicit model selection.",
|
|
29
|
+
})))
|
|
30
|
+
.annotateMerge(OpenApi.annotations({
|
|
31
|
+
title: "model",
|
|
32
|
+
description: "Experimental model routes.",
|
|
33
|
+
}));
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { Location } from "@opencode-ai/schema/location";
|
|
2
|
+
import { Context, Schema } from "effect";
|
|
3
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from "effect/unstable/httpapi";
|
|
4
|
+
import { PermissionNotFoundError, SessionNotFoundError } from "../errors.js";
|
|
5
|
+
export declare const makePermissionGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService>(locationMiddleware: Context.Key<LocationId, LocationService>, sessionLocationMiddleware: Context.Key<SessionLocationId, SessionLocationService>) => HttpApiGroup.HttpApiGroup<"server.permission", HttpApiEndpoint.HttpApiEndpoint<"permission.request.list", "GET", "/api/permission/request", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
6
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
7
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
8
|
+
readonly workspace: Schema.optional<Schema.String>;
|
|
9
|
+
}>>;
|
|
10
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
11
|
+
readonly location: typeof Location.Info;
|
|
12
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
13
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
14
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
15
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
16
|
+
};
|
|
17
|
+
readonly action: Schema.String;
|
|
18
|
+
readonly resources: Schema.$Array<Schema.String>;
|
|
19
|
+
readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
|
|
20
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
21
|
+
readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
|
|
22
|
+
readonly type: Schema.Literal<"tool">;
|
|
23
|
+
readonly messageID: Schema.String;
|
|
24
|
+
readonly id: Schema.String;
|
|
25
|
+
}>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
26
|
+
readonly type: Schema.Literal<"tool">;
|
|
27
|
+
readonly messageID: Schema.String;
|
|
28
|
+
readonly id: Schema.String;
|
|
29
|
+
}>]>>, never, never>;
|
|
30
|
+
readonly id: Schema.brand<Schema.String, "Permission.ID"> & {
|
|
31
|
+
create: (id?: string) => string & import("effect/Brand").Brand<"Permission.ID">;
|
|
32
|
+
};
|
|
33
|
+
}>>;
|
|
34
|
+
}>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"permission.saved.list", "GET", "/api/permission/saved", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
35
|
+
readonly projectID: Schema.optional<Schema.brand<Schema.String, "Project.ID"> & {
|
|
36
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
37
|
+
}>;
|
|
38
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
39
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
40
|
+
readonly id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
|
|
41
|
+
create: () => string & import("effect/Brand").Brand<"PermissionSaved.ID">;
|
|
42
|
+
};
|
|
43
|
+
readonly projectID: Schema.brand<Schema.String, "Project.ID"> & {
|
|
44
|
+
global: string & import("effect/Brand").Brand<"Project.ID">;
|
|
45
|
+
};
|
|
46
|
+
readonly action: Schema.String;
|
|
47
|
+
readonly resource: Schema.String;
|
|
48
|
+
}>>;
|
|
49
|
+
}>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"permission.saved.remove", "DELETE", "/api/permission/saved/:id", Schema.toCodecStringTree<Schema.Struct<{
|
|
50
|
+
id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
|
|
51
|
+
create: () => string & import("effect/Brand").Brand<"PermissionSaved.ID">;
|
|
52
|
+
};
|
|
53
|
+
}>>, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"session.permission.create", "POST", "/api/session/:sessionID/permission", Schema.toCodecStringTree<Schema.Struct<{
|
|
54
|
+
sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
55
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
56
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
57
|
+
};
|
|
58
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
59
|
+
readonly id: Schema.optional<Schema.brand<Schema.String, "Permission.ID"> & {
|
|
60
|
+
create: (id?: string) => string & import("effect/Brand").Brand<"Permission.ID">;
|
|
61
|
+
}>;
|
|
62
|
+
readonly action: Schema.String;
|
|
63
|
+
readonly resources: Schema.$Array<Schema.String>;
|
|
64
|
+
readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
|
|
65
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
66
|
+
readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
|
|
67
|
+
readonly type: Schema.Literal<"tool">;
|
|
68
|
+
readonly messageID: Schema.String;
|
|
69
|
+
readonly id: Schema.String;
|
|
70
|
+
}>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
71
|
+
readonly type: Schema.Literal<"tool">;
|
|
72
|
+
readonly messageID: Schema.String;
|
|
73
|
+
readonly id: Schema.String;
|
|
74
|
+
}>]>>, never, never>;
|
|
75
|
+
readonly agent: Schema.optional<Schema.brand<Schema.String, "Agent.ID">>;
|
|
76
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
77
|
+
readonly data: Schema.Struct<{
|
|
78
|
+
readonly id: Schema.brand<Schema.String, "Permission.ID"> & {
|
|
79
|
+
create: (id?: string) => string & import("effect/Brand").Brand<"Permission.ID">;
|
|
80
|
+
};
|
|
81
|
+
readonly effect: Schema.Literals<readonly ["allow", "deny", "ask"]>;
|
|
82
|
+
}>;
|
|
83
|
+
}>>, Schema.toCodecJson<typeof SessionNotFoundError>, SessionLocationId, HttpApiMiddleware.Requires<SessionLocationId>> | HttpApiEndpoint.HttpApiEndpoint<"session.permission.list", "GET", "/api/session/:sessionID/permission", Schema.toCodecStringTree<Schema.Struct<{
|
|
84
|
+
sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
85
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
86
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
87
|
+
};
|
|
88
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
89
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
90
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
91
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
92
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
93
|
+
};
|
|
94
|
+
readonly action: Schema.String;
|
|
95
|
+
readonly resources: Schema.$Array<Schema.String>;
|
|
96
|
+
readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
|
|
97
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
98
|
+
readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
|
|
99
|
+
readonly type: Schema.Literal<"tool">;
|
|
100
|
+
readonly messageID: Schema.String;
|
|
101
|
+
readonly id: Schema.String;
|
|
102
|
+
}>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
103
|
+
readonly type: Schema.Literal<"tool">;
|
|
104
|
+
readonly messageID: Schema.String;
|
|
105
|
+
readonly id: Schema.String;
|
|
106
|
+
}>]>>, never, never>;
|
|
107
|
+
readonly id: Schema.brand<Schema.String, "Permission.ID"> & {
|
|
108
|
+
create: (id?: string) => string & import("effect/Brand").Brand<"Permission.ID">;
|
|
109
|
+
};
|
|
110
|
+
}>>;
|
|
111
|
+
}>>, Schema.toCodecJson<typeof SessionNotFoundError>, SessionLocationId, HttpApiMiddleware.Requires<SessionLocationId>> | HttpApiEndpoint.HttpApiEndpoint<"session.permission.get", "GET", "/api/session/:sessionID/permission/:requestID", Schema.toCodecStringTree<Schema.Struct<{
|
|
112
|
+
sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
113
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
114
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
115
|
+
};
|
|
116
|
+
requestID: Schema.brand<Schema.String, "Permission.ID"> & {
|
|
117
|
+
create: (id?: string) => string & import("effect/Brand").Brand<"Permission.ID">;
|
|
118
|
+
};
|
|
119
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
120
|
+
readonly data: Schema.Struct<{
|
|
121
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
122
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
123
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
124
|
+
};
|
|
125
|
+
readonly action: Schema.String;
|
|
126
|
+
readonly resources: Schema.$Array<Schema.String>;
|
|
127
|
+
readonly save: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
|
|
128
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
129
|
+
readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
|
|
130
|
+
readonly type: Schema.Literal<"tool">;
|
|
131
|
+
readonly messageID: Schema.String;
|
|
132
|
+
readonly id: Schema.String;
|
|
133
|
+
}>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
|
|
134
|
+
readonly type: Schema.Literal<"tool">;
|
|
135
|
+
readonly messageID: Schema.String;
|
|
136
|
+
readonly id: Schema.String;
|
|
137
|
+
}>]>>, never, never>;
|
|
138
|
+
readonly id: Schema.brand<Schema.String, "Permission.ID"> & {
|
|
139
|
+
create: (id?: string) => string & import("effect/Brand").Brand<"Permission.ID">;
|
|
140
|
+
};
|
|
141
|
+
}>;
|
|
142
|
+
}>>, Schema.toCodecJson<typeof SessionNotFoundError | typeof PermissionNotFoundError>, SessionLocationId, HttpApiMiddleware.Requires<SessionLocationId>> | HttpApiEndpoint.HttpApiEndpoint<"session.permission.reply", "POST", "/api/session/:sessionID/permission/:requestID/reply", Schema.toCodecStringTree<Schema.Struct<{
|
|
143
|
+
sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
144
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
145
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
146
|
+
};
|
|
147
|
+
requestID: Schema.brand<Schema.String, "Permission.ID"> & {
|
|
148
|
+
create: (id?: string) => string & import("effect/Brand").Brand<"Permission.ID">;
|
|
149
|
+
};
|
|
150
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
151
|
+
readonly reply: Schema.Literals<readonly ["once", "always", "reject"]>;
|
|
152
|
+
readonly message: Schema.optional<Schema.String>;
|
|
153
|
+
}>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof SessionNotFoundError | typeof PermissionNotFoundError>, SessionLocationId, HttpApiMiddleware.Requires<SessionLocationId>>, false>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Agent } from "@opencode-ai/schema/agent";
|
|
2
|
+
import { Location } from "@opencode-ai/schema/location";
|
|
3
|
+
import { Permission } from "@opencode-ai/schema/permission";
|
|
4
|
+
import { PermissionSaved } from "@opencode-ai/schema/permission-saved";
|
|
5
|
+
import { Project } from "@opencode-ai/schema/project";
|
|
6
|
+
import { Session } from "@opencode-ai/schema/session";
|
|
7
|
+
import { Context, Schema } from "effect";
|
|
8
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
|
|
9
|
+
import { PermissionNotFoundError, SessionNotFoundError } from "../errors.js";
|
|
10
|
+
import { LocationQuery, locationQueryOpenApi } from "./location.js";
|
|
11
|
+
export const makePermissionGroup = (locationMiddleware, sessionLocationMiddleware) => HttpApiGroup.make("server.permission")
|
|
12
|
+
.add(HttpApiEndpoint.get("permission.request.list", "/api/permission/request", {
|
|
13
|
+
query: LocationQuery,
|
|
14
|
+
success: Location.response(Schema.Array(Permission.Request)),
|
|
15
|
+
})
|
|
16
|
+
.annotateMerge(locationQueryOpenApi)
|
|
17
|
+
.annotateMerge(OpenApi.annotations({
|
|
18
|
+
identifier: "v2.permission.request.list",
|
|
19
|
+
summary: "List pending permission requests",
|
|
20
|
+
description: "Retrieve pending permission requests for a location.",
|
|
21
|
+
})))
|
|
22
|
+
.add(HttpApiEndpoint.get("permission.saved.list", "/api/permission/saved", {
|
|
23
|
+
query: Schema.Struct({ projectID: Project.ID.pipe(Schema.optional) }),
|
|
24
|
+
success: Schema.Struct({ data: Schema.Array(PermissionSaved.Info) }),
|
|
25
|
+
}).annotateMerge(OpenApi.annotations({
|
|
26
|
+
identifier: "v2.permission.saved.list",
|
|
27
|
+
summary: "List saved permissions",
|
|
28
|
+
description: "Retrieve saved permissions, optionally filtered by project.",
|
|
29
|
+
})))
|
|
30
|
+
.add(HttpApiEndpoint.delete("permission.saved.remove", "/api/permission/saved/:id", {
|
|
31
|
+
params: { id: PermissionSaved.ID },
|
|
32
|
+
success: HttpApiSchema.NoContent,
|
|
33
|
+
}).annotateMerge(OpenApi.annotations({
|
|
34
|
+
identifier: "v2.permission.saved.remove",
|
|
35
|
+
summary: "Remove saved permission",
|
|
36
|
+
description: "Remove a saved permission by ID.",
|
|
37
|
+
})))
|
|
38
|
+
// Effect applies group middleware only to endpoints already added; session endpoints use session placement below.
|
|
39
|
+
.middleware(locationMiddleware)
|
|
40
|
+
.add(HttpApiEndpoint.post("session.permission.create", "/api/session/:sessionID/permission", {
|
|
41
|
+
params: { sessionID: Session.ID },
|
|
42
|
+
payload: Schema.Struct({
|
|
43
|
+
id: Permission.ID.pipe(Schema.optional),
|
|
44
|
+
action: Permission.Request.fields.action,
|
|
45
|
+
resources: Permission.Request.fields.resources,
|
|
46
|
+
save: Permission.Request.fields.save,
|
|
47
|
+
metadata: Permission.Request.fields.metadata,
|
|
48
|
+
source: Permission.Request.fields.source,
|
|
49
|
+
agent: Agent.ID.pipe(Schema.optional),
|
|
50
|
+
}),
|
|
51
|
+
success: Schema.Struct({
|
|
52
|
+
data: Schema.Struct({ id: Permission.ID, effect: Permission.Effect }),
|
|
53
|
+
}),
|
|
54
|
+
error: SessionNotFoundError,
|
|
55
|
+
})
|
|
56
|
+
.middleware(sessionLocationMiddleware)
|
|
57
|
+
.annotateMerge(OpenApi.annotations({
|
|
58
|
+
identifier: "v2.session.permission.create",
|
|
59
|
+
summary: "Create permission request",
|
|
60
|
+
description: "Evaluate and, when approval is required, create a permission request for a session.",
|
|
61
|
+
})))
|
|
62
|
+
.add(HttpApiEndpoint.get("session.permission.list", "/api/session/:sessionID/permission", {
|
|
63
|
+
params: { sessionID: Session.ID },
|
|
64
|
+
success: Schema.Struct({ data: Schema.Array(Permission.Request) }),
|
|
65
|
+
error: SessionNotFoundError,
|
|
66
|
+
})
|
|
67
|
+
.middleware(sessionLocationMiddleware)
|
|
68
|
+
.annotateMerge(OpenApi.annotations({
|
|
69
|
+
identifier: "v2.session.permission.list",
|
|
70
|
+
summary: "List session permission requests",
|
|
71
|
+
description: "Retrieve pending permission requests owned by a session.",
|
|
72
|
+
})))
|
|
73
|
+
.add(HttpApiEndpoint.get("session.permission.get", "/api/session/:sessionID/permission/:requestID", {
|
|
74
|
+
params: { sessionID: Session.ID, requestID: Permission.ID },
|
|
75
|
+
success: Schema.Struct({ data: Permission.Request }),
|
|
76
|
+
error: [SessionNotFoundError, PermissionNotFoundError],
|
|
77
|
+
})
|
|
78
|
+
.middleware(sessionLocationMiddleware)
|
|
79
|
+
.annotateMerge(OpenApi.annotations({
|
|
80
|
+
identifier: "v2.session.permission.get",
|
|
81
|
+
summary: "Get permission request",
|
|
82
|
+
description: "Retrieve a pending permission request owned by a session.",
|
|
83
|
+
})))
|
|
84
|
+
.add(HttpApiEndpoint.post("session.permission.reply", "/api/session/:sessionID/permission/:requestID/reply", {
|
|
85
|
+
params: { sessionID: Session.ID, requestID: Permission.ID },
|
|
86
|
+
payload: Schema.Struct({
|
|
87
|
+
reply: Permission.Reply,
|
|
88
|
+
message: Schema.String.pipe(Schema.optional),
|
|
89
|
+
}),
|
|
90
|
+
success: HttpApiSchema.NoContent,
|
|
91
|
+
error: [SessionNotFoundError, PermissionNotFoundError],
|
|
92
|
+
})
|
|
93
|
+
.middleware(sessionLocationMiddleware)
|
|
94
|
+
.annotateMerge(OpenApi.annotations({
|
|
95
|
+
identifier: "v2.session.permission.reply",
|
|
96
|
+
summary: "Reply to pending permission request",
|
|
97
|
+
description: "Respond to a pending permission request owned by a session.",
|
|
98
|
+
})))
|
|
99
|
+
.annotateMerge(OpenApi.annotations({ title: "permission", description: "Experimental permission routes." }));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Location } from "@opencode-ai/schema/location";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
4
|
+
export declare const PluginGroup: HttpApiGroup.HttpApiGroup<"server.plugin", HttpApiEndpoint.HttpApiEndpoint<"plugin.list", "GET", "/api/plugin", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
5
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
6
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
7
|
+
readonly workspace: Schema.optional<Schema.String>;
|
|
8
|
+
}>>;
|
|
9
|
+
}>>, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
10
|
+
readonly location: typeof Location.Info;
|
|
11
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
12
|
+
readonly id: Schema.brand<Schema.String, "Plugin.ID">;
|
|
13
|
+
}>>;
|
|
14
|
+
}>>, never, never, never>, false>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Location } from "@opencode-ai/schema/location";
|
|
2
|
+
import { Plugin } from "@opencode-ai/schema/plugin";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
|
|
5
|
+
import { LocationQuery, locationQueryOpenApi } from "./location.js";
|
|
6
|
+
export const PluginGroup = HttpApiGroup.make("server.plugin")
|
|
7
|
+
.add(HttpApiEndpoint.get("plugin.list", "/api/plugin", {
|
|
8
|
+
query: LocationQuery,
|
|
9
|
+
success: Location.response(Schema.Array(Plugin.Info)),
|
|
10
|
+
})
|
|
11
|
+
.annotateMerge(locationQueryOpenApi)
|
|
12
|
+
.annotateMerge(OpenApi.annotations({
|
|
13
|
+
identifier: "v2.plugin.list",
|
|
14
|
+
summary: "List plugins",
|
|
15
|
+
description: "Retrieve currently loaded plugins.",
|
|
16
|
+
})))
|
|
17
|
+
.annotateMerge(OpenApi.annotations({
|
|
18
|
+
title: "plugin",
|
|
19
|
+
description: "Experimental plugin routes.",
|
|
20
|
+
}));
|