@opencode-ai/protocol 0.0.0-next-14744 → 0.0.0-next-14759
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 +8 -11
- package/dist/api.js +5 -5
- package/dist/client.d.ts +3 -3
- package/dist/client.js +2 -5
- package/dist/errors.d.ts +3 -15
- package/dist/errors.js +2 -12
- package/dist/groups/event.d.ts +7625 -5011
- package/dist/groups/question.d.ts +92 -0
- package/dist/groups/question.js +56 -0
- package/package.json +2 -2
- package/dist/groups/form.d.ts +0 -823
- package/dist/groups/form.js +0 -110
package/dist/groups/form.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { Form } from "@opencode-ai/schema/form";
|
|
2
|
-
import { Location } from "@opencode-ai/schema/location";
|
|
3
|
-
import { Context, Schema } from "effect";
|
|
4
|
-
import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
|
|
5
|
-
import { ConflictError, FormAlreadySettledError, FormInvalidAnswerError, FormNotFoundError, InvalidRequestError } from "../errors.js";
|
|
6
|
-
import { LocationQuery, locationQueryOpenApi } from "./location.js";
|
|
7
|
-
const CreatePayload = Schema.Struct({
|
|
8
|
-
id: Form.ID.pipe(Schema.optional),
|
|
9
|
-
title: Form.FormInfo.fields.title,
|
|
10
|
-
metadata: Form.FormInfo.fields.metadata,
|
|
11
|
-
mode: Schema.Literals(["form", "url"]),
|
|
12
|
-
fields: Form.FormInfo.fields.fields.pipe(Schema.optional),
|
|
13
|
-
url: Form.UrlInfo.fields.url.pipe(Schema.optional),
|
|
14
|
-
}).annotate({ identifier: "Form.CreatePayload" });
|
|
15
|
-
// Form routes intentionally look session-scoped, but use a form-specific middleware instead of
|
|
16
|
-
// SessionLocationMiddleware. The middleware treats real session IDs normally and has an
|
|
17
|
-
// undocumented `global` sentinel branch for MCP elicitation forms that are still Location-scoped
|
|
18
|
-
// but not session-owned. This is temporary and should disappear once elicitations are attributable.
|
|
19
|
-
export const makeFormGroup = (locationMiddleware, formLocationMiddleware) => HttpApiGroup.make("server.form")
|
|
20
|
-
.add(HttpApiEndpoint.get("form.request.list", "/api/form/request", {
|
|
21
|
-
query: LocationQuery,
|
|
22
|
-
success: Location.response(Schema.Array(Form.Info)),
|
|
23
|
-
})
|
|
24
|
-
.annotateMerge(locationQueryOpenApi)
|
|
25
|
-
.annotateMerge(OpenApi.annotations({
|
|
26
|
-
identifier: "v2.form.request.list",
|
|
27
|
-
summary: "List pending form requests",
|
|
28
|
-
description: "Retrieve pending forms for a location.",
|
|
29
|
-
})))
|
|
30
|
-
.middleware(locationMiddleware)
|
|
31
|
-
.add(HttpApiEndpoint.get("session.form.list", "/api/session/:sessionID/form", {
|
|
32
|
-
params: { sessionID: Schema.String },
|
|
33
|
-
query: LocationQuery,
|
|
34
|
-
success: Location.response(Schema.Array(Form.Info)),
|
|
35
|
-
})
|
|
36
|
-
.annotateMerge(locationQueryOpenApi)
|
|
37
|
-
.annotateMerge(OpenApi.annotations({
|
|
38
|
-
identifier: "v2.session.form.list",
|
|
39
|
-
summary: "List session forms",
|
|
40
|
-
description: "Retrieve pending forms for a session.",
|
|
41
|
-
}))
|
|
42
|
-
.middleware(formLocationMiddleware))
|
|
43
|
-
.add(HttpApiEndpoint.post("session.form.create", "/api/session/:sessionID/form", {
|
|
44
|
-
params: { sessionID: Schema.String },
|
|
45
|
-
query: LocationQuery,
|
|
46
|
-
payload: CreatePayload,
|
|
47
|
-
success: Location.response(Form.Info),
|
|
48
|
-
error: [ConflictError, InvalidRequestError],
|
|
49
|
-
})
|
|
50
|
-
.annotateMerge(locationQueryOpenApi)
|
|
51
|
-
.annotateMerge(OpenApi.annotations({
|
|
52
|
-
identifier: "v2.session.form.create",
|
|
53
|
-
summary: "Create session form",
|
|
54
|
-
description: "Create a form for a session.",
|
|
55
|
-
}))
|
|
56
|
-
.middleware(formLocationMiddleware))
|
|
57
|
-
.add(HttpApiEndpoint.get("session.form.get", "/api/session/:sessionID/form/:formID", {
|
|
58
|
-
params: { sessionID: Schema.String, formID: Form.ID },
|
|
59
|
-
query: LocationQuery,
|
|
60
|
-
success: Location.response(Form.Info),
|
|
61
|
-
error: FormNotFoundError,
|
|
62
|
-
})
|
|
63
|
-
.annotateMerge(locationQueryOpenApi)
|
|
64
|
-
.annotateMerge(OpenApi.annotations({
|
|
65
|
-
identifier: "v2.session.form.get",
|
|
66
|
-
summary: "Get session form",
|
|
67
|
-
description: "Retrieve a form for a session.",
|
|
68
|
-
}))
|
|
69
|
-
.middleware(formLocationMiddleware))
|
|
70
|
-
.add(HttpApiEndpoint.get("session.form.state", "/api/session/:sessionID/form/:formID/state", {
|
|
71
|
-
params: { sessionID: Schema.String, formID: Form.ID },
|
|
72
|
-
query: LocationQuery,
|
|
73
|
-
success: Location.response(Form.State),
|
|
74
|
-
error: FormNotFoundError,
|
|
75
|
-
})
|
|
76
|
-
.annotateMerge(locationQueryOpenApi)
|
|
77
|
-
.annotateMerge(OpenApi.annotations({
|
|
78
|
-
identifier: "v2.session.form.state",
|
|
79
|
-
summary: "Get form state",
|
|
80
|
-
description: "Retrieve the current state for a form.",
|
|
81
|
-
}))
|
|
82
|
-
.middleware(formLocationMiddleware))
|
|
83
|
-
.add(HttpApiEndpoint.post("session.form.reply", "/api/session/:sessionID/form/:formID/reply", {
|
|
84
|
-
params: { sessionID: Schema.String, formID: Form.ID },
|
|
85
|
-
query: LocationQuery,
|
|
86
|
-
payload: Form.Reply,
|
|
87
|
-
success: HttpApiSchema.NoContent,
|
|
88
|
-
error: [FormAlreadySettledError, FormInvalidAnswerError, FormNotFoundError],
|
|
89
|
-
})
|
|
90
|
-
.annotateMerge(locationQueryOpenApi)
|
|
91
|
-
.annotateMerge(OpenApi.annotations({
|
|
92
|
-
identifier: "v2.session.form.reply",
|
|
93
|
-
summary: "Reply to form",
|
|
94
|
-
description: "Submit an answer to a pending form.",
|
|
95
|
-
}))
|
|
96
|
-
.middleware(formLocationMiddleware))
|
|
97
|
-
.add(HttpApiEndpoint.post("session.form.cancel", "/api/session/:sessionID/form/:formID/cancel", {
|
|
98
|
-
params: { sessionID: Schema.String, formID: Form.ID },
|
|
99
|
-
query: LocationQuery,
|
|
100
|
-
success: HttpApiSchema.NoContent,
|
|
101
|
-
error: [FormAlreadySettledError, FormNotFoundError],
|
|
102
|
-
})
|
|
103
|
-
.annotateMerge(locationQueryOpenApi)
|
|
104
|
-
.annotateMerge(OpenApi.annotations({
|
|
105
|
-
identifier: "v2.session.form.cancel",
|
|
106
|
-
summary: "Cancel form",
|
|
107
|
-
description: "Cancel a pending form.",
|
|
108
|
-
}))
|
|
109
|
-
.middleware(formLocationMiddleware))
|
|
110
|
-
.annotateMerge(OpenApi.annotations({ title: "forms", description: "Session form routes." }));
|