@opencode/protocol 0.0.0-dev-19555 → 0.0.0-dev-19557

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.
@@ -1,5 +1,4 @@
1
1
  import { SessionMessage } from "@opencode/schema/session-message";
2
- import { SessionTransfer } from "@opencode/schema/session-transfer";
3
2
  import { SessionInbox } from "@opencode/schema/session-inbox";
4
3
  import { PromptInput } from "@opencode/schema/prompt-input";
5
4
  import { Session } from "@opencode/schema/session";
@@ -8,7 +7,6 @@ import { InstructionEntry } from "@opencode/schema/instruction-entry";
8
7
  import { Project } from "@opencode/schema/project";
9
8
  import { AbsolutePath, NonNegativeInt, PositiveInt, RelativePath, statics } from "@opencode/schema/schema";
10
9
  import { Event } from "@opencode/schema/event";
11
- import { Workspace } from "@opencode/schema/workspace";
12
10
  import { Context, Effect, Encoding, Result, Schema, SchemaGetter, Struct } from "effect";
13
11
  import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
14
12
  import { ConflictError, CommandExecutionError, CommandNotFoundError, InvalidCursorError, InvalidRequestError, MessageNotFoundError, ServiceUnavailableError, SessionBusyError, SessionNotFoundError, SkillNotFoundError, UnknownError, } from "../errors.js";
@@ -20,6 +18,7 @@ import { Location } from "@opencode/schema/location";
20
18
  import { SessionEvent } from "@opencode/schema/session-event";
21
19
  import { EventLog } from "@opencode/schema/event-log";
22
20
  import { FileDiff } from "@opencode/schema/file-diff";
21
+ import { PublicSessionMessage } from "./message.js";
23
22
  const ParentIDFilter = Schema.Union([
24
23
  Session.ID,
25
24
  Schema.Null.pipe(Schema.encodeTo(Schema.Literal("null"), {
@@ -30,7 +29,6 @@ const ParentIDFilter = Schema.Union([
30
29
  description: "Filter by parent session. Use null to return only root sessions.",
31
30
  });
32
31
  const SessionsQueryFields = {
33
- workspace: Workspace.ID.pipe(Schema.optional),
34
32
  limit: Schema.NumberFromString.pipe(Schema.decodeTo(PositiveInt), Schema.optional).annotate({
35
33
  description: "Maximum number of sessions to return. Defaults to the newest 50 sessions.",
36
34
  }),
@@ -78,6 +76,28 @@ export const SessionsCursor = Schema.String.pipe(Schema.brand("SessionsCursor"),
78
76
  const SessionActive = Schema.Struct({
79
77
  type: Schema.Literal("running"),
80
78
  }).annotate({ identifier: "SessionActive" });
79
+ const PublicSessionInfo = Schema.Struct({
80
+ ...Struct.omit(Session.Info.fields, ["location"]),
81
+ location: Location.PublicRef,
82
+ }).annotate({ identifier: "Session.Info" });
83
+ const PublicSessionTransfer = Schema.Struct({
84
+ info: PublicSessionInfo,
85
+ messages: Schema.Array(PublicSessionMessage),
86
+ }).annotate({ identifier: "SessionTransfer.Data" });
87
+ const PublicMovePayload = Schema.Struct({
88
+ ...Struct.omit(SessionInbox.MovePayload.fields, ["location"]),
89
+ location: Location.PublicRef,
90
+ }).annotate({ identifier: "Session.Inbox.MovePayload" });
91
+ const PublicMove = Schema.Struct({
92
+ ...Struct.omit(SessionInbox.Move.fields, ["payload"]),
93
+ payload: PublicMovePayload,
94
+ }).annotate({ identifier: "Session.Inbox.Move" });
95
+ const PublicInboxInfo = Schema.Union([
96
+ SessionInbox.User,
97
+ SessionInbox.Synthetic,
98
+ SessionInbox.Compaction,
99
+ PublicMove,
100
+ ]).annotate({ identifier: "Session.Inbox.Info" });
81
101
  const BooleanFromString = Schema.Literals(["true", "false"]).pipe(Schema.decodeTo(Schema.Boolean, {
82
102
  decode: SchemaGetter.transform((value) => value === "true"),
83
103
  encode: SchemaGetter.transform((value) => (value ? "true" : "false")),
@@ -96,7 +116,7 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
96
116
  .add(HttpApiEndpoint.get("session.list", "/api/session", {
97
117
  query: SessionsQuery,
98
118
  success: Schema.Struct({
99
- data: Schema.Array(Session.Info),
119
+ data: Schema.Array(PublicSessionInfo),
100
120
  cursor: Schema.Struct({
101
121
  previous: SessionsCursor.pipe(Schema.optional),
102
122
  next: SessionsCursor.pipe(Schema.optional),
@@ -129,11 +149,11 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
129
149
  title: Schema.String.pipe(Schema.optional),
130
150
  agent: Agent.ID.pipe(Schema.optional),
131
151
  model: Model.Ref.pipe(Schema.optional),
132
- location: Location.Ref.pipe(Schema.optional),
152
+ location: Location.PublicRef.pipe(Schema.optional),
133
153
  metadata: Session.Metadata.pipe(Schema.optional),
134
154
  permissions: Permission.Ruleset.pipe(Schema.optional),
135
155
  }),
136
- success: Schema.Struct({ data: Session.Info }),
156
+ success: Schema.Struct({ data: PublicSessionInfo }),
137
157
  }).annotateMerge(OpenApi.annotations({
138
158
  identifier: "session.create",
139
159
  summary: "Create session",
@@ -141,10 +161,10 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
141
161
  })))
142
162
  .add(HttpApiEndpoint.post("session.import", "/api/session/import", {
143
163
  payload: Schema.Struct({
144
- ...SessionTransfer.Data.fields,
145
- location: Location.Ref.pipe(Schema.optional),
164
+ ...PublicSessionTransfer.fields,
165
+ location: Location.PublicRef.pipe(Schema.optional),
146
166
  }),
147
- success: Schema.Struct({ data: Session.Info }),
167
+ success: Schema.Struct({ data: PublicSessionInfo }),
148
168
  error: [ConflictError, SessionNotFoundError],
149
169
  }).annotateMerge(OpenApi.annotations({
150
170
  identifier: "session.import",
@@ -154,7 +174,7 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
154
174
  .add(HttpApiEndpoint.get("session.export", "/api/session/:sessionID/export", {
155
175
  params: { sessionID: Session.ID },
156
176
  query: Schema.Struct({ sanitize: BooleanFromString.pipe(Schema.optional) }),
157
- success: Schema.Struct({ data: SessionTransfer.Data }),
177
+ success: Schema.Struct({ data: PublicSessionTransfer }),
158
178
  error: [SessionNotFoundError, UnknownError],
159
179
  }).annotateMerge(OpenApi.annotations({
160
180
  identifier: "session.export",
@@ -170,7 +190,7 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
170
190
  })))
171
191
  .add(HttpApiEndpoint.get("session.get", "/api/session/:sessionID", {
172
192
  params: { sessionID: Session.ID },
173
- success: Schema.Struct({ data: Session.Info }),
193
+ success: Schema.Struct({ data: PublicSessionInfo }),
174
194
  error: SessionNotFoundError,
175
195
  }).annotateMerge(OpenApi.annotations({
176
196
  identifier: "session.get",
@@ -189,7 +209,7 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
189
209
  .add(HttpApiEndpoint.post("session.fork", "/api/session/:sessionID/fork", {
190
210
  params: { sessionID: Session.ID },
191
211
  payload: Schema.Struct({ boundary: Session.ForkRequestBoundary }),
192
- success: Schema.Struct({ data: Session.Info }),
212
+ success: Schema.Struct({ data: PublicSessionInfo }),
193
213
  error: [SessionNotFoundError, MessageNotFoundError, InvalidRequestError],
194
214
  })
195
215
  .middleware(sessionLocationMiddleware)
@@ -236,7 +256,7 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
236
256
  })))
237
257
  .add(HttpApiEndpoint.post("session.move", "/api/session/:sessionID/move", {
238
258
  params: { sessionID: Session.ID },
239
- payload: Schema.Struct({ ...Location.Ref.fields, delivery: SessionInbox.Delivery.pipe(Schema.optional) }),
259
+ payload: Schema.Struct({ ...Location.PublicRef.fields, delivery: SessionInbox.Delivery.pipe(Schema.optional) }),
240
260
  success: HttpApiSchema.NoContent,
241
261
  error: [SessionNotFoundError, InvalidRequestError],
242
262
  }).annotateMerge(OpenApi.annotations({
@@ -382,7 +402,7 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
382
402
  .annotateMerge(OpenApi.annotations({ identifier: "session.revert.commit", summary: "Commit staged revert" })))
383
403
  .add(HttpApiEndpoint.get("session.context", "/api/session/:sessionID/context", {
384
404
  params: { sessionID: Session.ID },
385
- success: Schema.Struct({ data: Schema.Array(SessionMessage.Info) }),
405
+ success: Schema.Struct({ data: Schema.Array(PublicSessionMessage) }),
386
406
  error: [SessionNotFoundError, UnknownError],
387
407
  }).annotateMerge(OpenApi.annotations({
388
408
  identifier: "session.context",
@@ -411,7 +431,7 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
411
431
  })))
412
432
  .add(HttpApiEndpoint.get("session.inbox.list", "/api/session/:sessionID/inbox", {
413
433
  params: { sessionID: Session.ID },
414
- success: Schema.Struct({ data: Schema.Array(SessionInbox.Info) }),
434
+ success: Schema.Struct({ data: Schema.Array(PublicInboxInfo) }),
415
435
  error: SessionNotFoundError,
416
436
  }).annotateMerge(OpenApi.annotations({
417
437
  identifier: "session.inbox.list",
@@ -537,7 +557,7 @@ export const makeSessionGroup = (sessionLocationMiddleware) => HttpApiGroup.make
537
557
  })))
538
558
  .add(HttpApiEndpoint.get("session.message", "/api/session/:sessionID/message/:messageID", {
539
559
  params: { sessionID: Session.ID, messageID: SessionMessage.ID },
540
- success: Schema.Struct({ data: SessionMessage.Info }),
560
+ success: Schema.Struct({ data: PublicSessionMessage }),
541
561
  error: [SessionNotFoundError, MessageNotFoundError],
542
562
  }).annotateMerge(OpenApi.annotations({
543
563
  identifier: "session.message",
@@ -1,14 +1,21 @@
1
- import { Location } from "@opencode/schema/location";
2
1
  import { Schema } from "effect";
3
2
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
4
3
  import { ShellNotFoundError } from "../errors.js";
5
4
  export declare const ShellGroup: HttpApiGroup.HttpApiGroup<"server.shell", HttpApiEndpoint.HttpApiEndpoint<"shell.list", "GET", "/api/shell", never, Schema.toCodecStringTree<Schema.Struct<{
6
5
  readonly location: Schema.optional<Schema.Struct<{
7
6
  readonly directory: Schema.optional<Schema.String>;
8
- readonly workspace: Schema.optional<Schema.String>;
9
7
  }>>;
10
8
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
11
- readonly location: typeof Location.Info;
9
+ readonly location: Schema.Struct<{
10
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
11
+ readonly project: Schema.Struct<{
12
+ readonly id: Schema.brand<Schema.String, "Project.ID"> & {
13
+ global: string & import("effect/Brand").Brand<"Project.ID">;
14
+ };
15
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
16
+ readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
17
+ }>;
18
+ }>;
12
19
  readonly data: Schema.$Array<Schema.Struct<{
13
20
  readonly id: Schema.brand<Schema.String, "Shell.ID"> & {
14
21
  create: () => string & import("effect/Brand").Brand<"Shell.ID">;
@@ -30,7 +37,6 @@ export declare const ShellGroup: HttpApiGroup.HttpApiGroup<"server.shell", HttpA
30
37
  }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"shell.create", "POST", "/api/shell", never, Schema.toCodecStringTree<Schema.Struct<{
31
38
  readonly location: Schema.optional<Schema.Struct<{
32
39
  readonly directory: Schema.optional<Schema.String>;
33
- readonly workspace: Schema.optional<Schema.String>;
34
40
  }>>;
35
41
  }>>, Schema.toCodecJson<Schema.Struct<{
36
42
  readonly command: Schema.String;
@@ -38,7 +44,16 @@ export declare const ShellGroup: HttpApiGroup.HttpApiGroup<"server.shell", HttpA
38
44
  readonly timeout: Schema.Int;
39
45
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
40
46
  }>>, never, Schema.toCodecJson<Schema.Struct<{
41
- readonly location: typeof Location.Info;
47
+ readonly location: Schema.Struct<{
48
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
49
+ readonly project: Schema.Struct<{
50
+ readonly id: Schema.brand<Schema.String, "Project.ID"> & {
51
+ global: string & import("effect/Brand").Brand<"Project.ID">;
52
+ };
53
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
54
+ readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
55
+ }>;
56
+ }>;
42
57
  readonly data: Schema.Struct<{
43
58
  readonly id: Schema.brand<Schema.String, "Shell.ID"> & {
44
59
  create: () => string & import("effect/Brand").Brand<"Shell.ID">;
@@ -65,10 +80,18 @@ export declare const ShellGroup: HttpApiGroup.HttpApiGroup<"server.shell", HttpA
65
80
  }>>, Schema.toCodecStringTree<Schema.Struct<{
66
81
  readonly location: Schema.optional<Schema.Struct<{
67
82
  readonly directory: Schema.optional<Schema.String>;
68
- readonly workspace: Schema.optional<Schema.String>;
69
83
  }>>;
70
84
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
71
- readonly location: typeof Location.Info;
85
+ readonly location: Schema.Struct<{
86
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
87
+ readonly project: Schema.Struct<{
88
+ readonly id: Schema.brand<Schema.String, "Project.ID"> & {
89
+ global: string & import("effect/Brand").Brand<"Project.ID">;
90
+ };
91
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
92
+ readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
93
+ }>;
94
+ }>;
72
95
  readonly data: Schema.Struct<{
73
96
  readonly id: Schema.brand<Schema.String, "Shell.ID"> & {
74
97
  create: () => string & import("effect/Brand").Brand<"Shell.ID">;
@@ -95,12 +118,20 @@ export declare const ShellGroup: HttpApiGroup.HttpApiGroup<"server.shell", HttpA
95
118
  }>>, Schema.toCodecStringTree<Schema.Struct<{
96
119
  readonly location: Schema.optional<Schema.Struct<{
97
120
  readonly directory: Schema.optional<Schema.String>;
98
- readonly workspace: Schema.optional<Schema.String>;
99
121
  }>>;
100
122
  }>>, Schema.toCodecJson<Schema.Struct<{
101
123
  readonly timeout: Schema.Int;
102
124
  }>>, never, Schema.toCodecJson<Schema.Struct<{
103
- readonly location: typeof Location.Info;
125
+ readonly location: Schema.Struct<{
126
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
127
+ readonly project: Schema.Struct<{
128
+ readonly id: Schema.brand<Schema.String, "Project.ID"> & {
129
+ global: string & import("effect/Brand").Brand<"Project.ID">;
130
+ };
131
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
132
+ readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
133
+ }>;
134
+ }>;
104
135
  readonly data: Schema.Struct<{
105
136
  readonly id: Schema.brand<Schema.String, "Shell.ID"> & {
106
137
  create: () => string & import("effect/Brand").Brand<"Shell.ID">;
@@ -129,10 +160,18 @@ export declare const ShellGroup: HttpApiGroup.HttpApiGroup<"server.shell", HttpA
129
160
  readonly limit: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
130
161
  readonly location: Schema.optional<Schema.Struct<{
131
162
  readonly directory: Schema.optional<Schema.String>;
132
- readonly workspace: Schema.optional<Schema.String>;
133
163
  }>>;
134
164
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
135
- readonly location: typeof Location.Info;
165
+ readonly location: Schema.Struct<{
166
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
167
+ readonly project: Schema.Struct<{
168
+ readonly id: Schema.brand<Schema.String, "Project.ID"> & {
169
+ global: string & import("effect/Brand").Brand<"Project.ID">;
170
+ };
171
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
172
+ readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
173
+ }>;
174
+ }>;
136
175
  readonly data: Schema.Struct<{
137
176
  readonly output: Schema.String;
138
177
  readonly cursor: Schema.Int;
@@ -147,6 +186,5 @@ export declare const ShellGroup: HttpApiGroup.HttpApiGroup<"server.shell", HttpA
147
186
  }>>, Schema.toCodecStringTree<Schema.Struct<{
148
187
  readonly location: Schema.optional<Schema.Struct<{
149
188
  readonly directory: Schema.optional<Schema.String>;
150
- readonly workspace: Schema.optional<Schema.String>;
151
189
  }>>;
152
190
  }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ShellNotFoundError>, never, never>, false>;
@@ -1,13 +1,20 @@
1
- import { Location } from "@opencode/schema/location";
2
1
  import { Schema } from "effect";
3
2
  import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
4
3
  export declare const SkillGroup: HttpApiGroup.HttpApiGroup<"server.skill", HttpApiEndpoint.HttpApiEndpoint<"skill.list", "GET", "/api/skill", never, Schema.toCodecStringTree<Schema.Struct<{
5
4
  readonly location: Schema.optional<Schema.Struct<{
6
5
  readonly directory: Schema.optional<Schema.String>;
7
- readonly workspace: Schema.optional<Schema.String>;
8
6
  }>>;
9
7
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
10
- readonly location: typeof Location.Info;
8
+ readonly location: Schema.Struct<{
9
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
10
+ readonly project: Schema.Struct<{
11
+ readonly id: Schema.brand<Schema.String, "Project.ID"> & {
12
+ global: string & import("effect/Brand").Brand<"Project.ID">;
13
+ };
14
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
15
+ readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
16
+ }>;
17
+ }>;
11
18
  readonly data: Schema.$Array<Schema.Struct<{
12
19
  readonly id: Schema.brand<Schema.String, "Skill.ID">;
13
20
  readonly name: Schema.brand<Schema.String, "Skill.Name">;
@@ -1,14 +1,21 @@
1
- import { Location } from "@opencode/schema/location";
2
1
  import { Schema } from "effect";
3
2
  import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
4
3
  import { ServiceUnavailableError } from "../errors.js";
5
4
  export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEndpoint.HttpApiEndpoint<"vcs.get", "GET", "/api/vcs", never, Schema.toCodecStringTree<Schema.Struct<{
6
5
  readonly location: Schema.optional<Schema.Struct<{
7
6
  readonly directory: Schema.optional<Schema.String>;
8
- readonly workspace: Schema.optional<Schema.String>;
9
7
  }>>;
10
8
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
11
- readonly location: typeof Location.Info;
9
+ readonly location: Schema.Struct<{
10
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
11
+ readonly project: Schema.Struct<{
12
+ readonly id: Schema.brand<Schema.String, "Project.ID"> & {
13
+ global: string & import("effect/Brand").Brand<"Project.ID">;
14
+ };
15
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
16
+ readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
17
+ }>;
18
+ }>;
12
19
  readonly data: Schema.Struct<{
13
20
  readonly branch: Schema.Struct<{
14
21
  readonly current: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
@@ -18,10 +25,18 @@ export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEn
18
25
  }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.base", "GET", "/api/vcs/base", never, Schema.toCodecStringTree<Schema.Struct<{
19
26
  readonly location: Schema.optional<Schema.Struct<{
20
27
  readonly directory: Schema.optional<Schema.String>;
21
- readonly workspace: Schema.optional<Schema.String>;
22
28
  }>>;
23
29
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
24
- readonly location: typeof Location.Info;
30
+ readonly location: Schema.Struct<{
31
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
32
+ readonly project: Schema.Struct<{
33
+ readonly id: Schema.brand<Schema.String, "Project.ID"> & {
34
+ global: string & import("effect/Brand").Brand<"Project.ID">;
35
+ };
36
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
37
+ readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
38
+ }>;
39
+ }>;
25
40
  readonly data: Schema.NullOr<Schema.Struct<{
26
41
  readonly name: Schema.String;
27
42
  readonly ref: Schema.String;
@@ -30,10 +45,18 @@ export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEn
30
45
  }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.status", "GET", "/api/vcs/status", never, Schema.toCodecStringTree<Schema.Struct<{
31
46
  readonly location: Schema.optional<Schema.Struct<{
32
47
  readonly directory: Schema.optional<Schema.String>;
33
- readonly workspace: Schema.optional<Schema.String>;
34
48
  }>>;
35
49
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
36
- readonly location: typeof Location.Info;
50
+ readonly location: Schema.Struct<{
51
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
52
+ readonly project: Schema.Struct<{
53
+ readonly id: Schema.brand<Schema.String, "Project.ID"> & {
54
+ global: string & import("effect/Brand").Brand<"Project.ID">;
55
+ };
56
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
57
+ readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
58
+ }>;
59
+ }>;
37
60
  readonly data: Schema.$Array<Schema.Struct<{
38
61
  readonly file: Schema.String;
39
62
  readonly additions: Schema.Int;
@@ -45,10 +68,18 @@ export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEn
45
68
  readonly limit: Schema.optional<Schema.compose<Schema.Int, Schema.NumberFromString>>;
46
69
  readonly location: Schema.optional<Schema.Struct<{
47
70
  readonly directory: Schema.optional<Schema.String>;
48
- readonly workspace: Schema.optional<Schema.String>;
49
71
  }>>;
50
72
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
51
- readonly location: typeof Location.Info;
73
+ readonly location: Schema.Struct<{
74
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
75
+ readonly project: Schema.Struct<{
76
+ readonly id: Schema.brand<Schema.String, "Project.ID"> & {
77
+ global: string & import("effect/Brand").Brand<"Project.ID">;
78
+ };
79
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
80
+ readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
81
+ }>;
82
+ }>;
52
83
  readonly data: Schema.$Array<Schema.String>;
53
84
  }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.diff", "GET", "/api/vcs/diff", never, Schema.toCodecStringTree<Schema.Struct<{
54
85
  readonly mode: Schema.Literals<readonly ["working", "branch", "committed"]>;
@@ -56,10 +87,18 @@ export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEn
56
87
  readonly context: Schema.optional<Schema.compose<Schema.Int, Schema.NumberFromString>>;
57
88
  readonly location: Schema.optional<Schema.Struct<{
58
89
  readonly directory: Schema.optional<Schema.String>;
59
- readonly workspace: Schema.optional<Schema.String>;
60
90
  }>>;
61
91
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
62
- readonly location: typeof Location.Info;
92
+ readonly location: Schema.Struct<{
93
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
94
+ readonly project: Schema.Struct<{
95
+ readonly id: Schema.brand<Schema.String, "Project.ID"> & {
96
+ global: string & import("effect/Brand").Brand<"Project.ID">;
97
+ };
98
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
99
+ readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
100
+ }>;
101
+ }>;
63
102
  readonly data: Schema.$Array<Schema.Struct<{
64
103
  readonly file: Schema.String;
65
104
  readonly patch: Schema.String;
@@ -1,4 +1,3 @@
1
- import { Location } from "@opencode/schema/location";
2
1
  import { WebSearch } from "@opencode/schema/websearch";
3
2
  import { Schema } from "effect";
4
3
  import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
@@ -6,10 +5,18 @@ import { InvalidRequestError, ServiceUnavailableError } from "../errors.js";
6
5
  export declare const WebSearchGroup: HttpApiGroup.HttpApiGroup<"server.websearch", HttpApiEndpoint.HttpApiEndpoint<"websearch.providers", "GET", "/api/websearch/provider", never, Schema.toCodecStringTree<Schema.Struct<{
7
6
  readonly location: Schema.optional<Schema.Struct<{
8
7
  readonly directory: Schema.optional<Schema.String>;
9
- readonly workspace: Schema.optional<Schema.String>;
10
8
  }>>;
11
9
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
12
- readonly location: typeof Location.Info;
10
+ readonly location: Schema.Struct<{
11
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
12
+ readonly project: Schema.Struct<{
13
+ readonly id: Schema.brand<Schema.String, "Project.ID"> & {
14
+ global: string & import("effect/Brand").Brand<"Project.ID">;
15
+ };
16
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
17
+ readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
18
+ }>;
19
+ }>;
13
20
  readonly data: Schema.$Array<Schema.Struct<{
14
21
  readonly id: Schema.brand<Schema.String, "WebSearch.ID">;
15
22
  readonly name: Schema.String;
@@ -17,12 +24,20 @@ export declare const WebSearchGroup: HttpApiGroup.HttpApiGroup<"server.websearch
17
24
  }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"websearch.query", "POST", "/api/websearch", never, Schema.toCodecStringTree<Schema.Struct<{
18
25
  readonly location: Schema.optional<Schema.Struct<{
19
26
  readonly directory: Schema.optional<Schema.String>;
20
- readonly workspace: Schema.optional<Schema.String>;
21
27
  }>>;
22
28
  }>>, Schema.toCodecJson<Schema.Struct<{
23
29
  readonly query: Schema.String;
24
30
  readonly providerID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "WebSearch.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "WebSearch.ID">>, never, never>;
25
31
  }>>, never, Schema.toCodecJson<Schema.Struct<{
26
- readonly location: typeof Location.Info;
32
+ readonly location: Schema.Struct<{
33
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
34
+ readonly project: Schema.Struct<{
35
+ readonly id: Schema.brand<Schema.String, "Project.ID"> & {
36
+ global: string & import("effect/Brand").Brand<"Project.ID">;
37
+ };
38
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
39
+ readonly canonical: Schema.brand<Schema.String, "AbsolutePath">;
40
+ }>;
41
+ }>;
27
42
  readonly data: typeof WebSearch.Response;
28
43
  }>>, Schema.toCodecJson<typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never>, false>;
@@ -12,7 +12,6 @@ export declare class WorktreeError extends WorktreeError_base {
12
12
  export declare const WorktreeGroup: HttpApiGroup.HttpApiGroup<"server.worktree", HttpApiEndpoint.HttpApiEndpoint<"worktree.list", "GET", "/api/worktree", never, Schema.toCodecStringTree<Schema.Struct<{
13
13
  readonly location: Schema.optional<Schema.Struct<{
14
14
  readonly directory: Schema.optional<Schema.String>;
15
- readonly workspace: Schema.optional<Schema.String>;
16
15
  }>>;
17
16
  }>>, never, never, Schema.toCodecJson<Schema.$Array<Schema.Struct<{
18
17
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
@@ -20,7 +19,6 @@ export declare const WorktreeGroup: HttpApiGroup.HttpApiGroup<"server.worktree",
20
19
  }>>>, Schema.toCodecJson<typeof WorktreeError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.create", "POST", "/api/worktree", never, Schema.toCodecStringTree<Schema.Struct<{
21
20
  readonly location: Schema.optional<Schema.Struct<{
22
21
  readonly directory: Schema.optional<Schema.String>;
23
- readonly workspace: Schema.optional<Schema.String>;
24
22
  }>>;
25
23
  }>>, Schema.toCodecJson<Schema.Struct<{
26
24
  readonly strategy: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.Trim, "Worktree.StrategyID">>>, Schema.optionalKey<Schema.brand<Schema.Trim, "Worktree.StrategyID">>, never, never>;
@@ -33,7 +31,6 @@ export declare const WorktreeGroup: HttpApiGroup.HttpApiGroup<"server.worktree",
33
31
  }>>, Schema.toCodecJson<typeof WorktreeError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.remove", "DELETE", "/api/worktree", never, Schema.toCodecStringTree<Schema.Struct<{
34
32
  readonly location: Schema.optional<Schema.Struct<{
35
33
  readonly directory: Schema.optional<Schema.String>;
36
- readonly workspace: Schema.optional<Schema.String>;
37
34
  }>>;
38
35
  }>>, Schema.toCodecJson<Schema.Struct<{
39
36
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
@@ -41,7 +38,6 @@ export declare const WorktreeGroup: HttpApiGroup.HttpApiGroup<"server.worktree",
41
38
  }>>, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof WorktreeError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"worktree.refresh", "POST", "/api/worktree/refresh", never, Schema.toCodecStringTree<Schema.Struct<{
42
39
  readonly location: Schema.optional<Schema.Struct<{
43
40
  readonly directory: Schema.optional<Schema.String>;
44
- readonly workspace: Schema.optional<Schema.String>;
45
41
  }>>;
46
42
  }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof WorktreeError>, never, never>, false>;
47
43
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/protocol",
4
- "version": "0.0.0-dev-19555",
4
+ "version": "0.0.0-dev-19557",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "typecheck": "tsgo --noEmit"
33
33
  },
34
34
  "dependencies": {
35
- "@opencode/schema": "0.0.0-dev-19555",
35
+ "@opencode/schema": "0.0.0-dev-19557",
36
36
  "effect": "4.0.0-rc.112"
37
37
  },
38
38
  "devDependencies": {
@@ -1,22 +0,0 @@
1
- import { Schema } from "effect";
2
- import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
3
- import { ConflictError, ProviderNotFoundError, UnknownError } from "../errors.js";
4
- export declare const WorkspaceGroup: HttpApiGroup.HttpApiGroup<"server.workspace", HttpApiEndpoint.HttpApiEndpoint<"workspace.create", "POST", "/api/workspace", never, never, Schema.toCodecJson<Schema.Struct<{
5
- readonly id: Schema.optional<Schema.brand<Schema.String, "Workspace.ID"> & {
6
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
7
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
8
- }>;
9
- readonly provider: Schema.String;
10
- }>>, never, Schema.toCodecJson<Schema.Struct<{
11
- readonly data: Schema.brand<Schema.String, "Workspace.ID"> & {
12
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
13
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
14
- };
15
- }>>, Schema.toCodecJson<typeof ConflictError | typeof ProviderNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"workspace.destroy", "DELETE", "/api/workspace/:workspaceID", Schema.toCodecStringTree<Schema.Struct<{
16
- workspaceID: Schema.brand<Schema.String, "Workspace.ID"> & {
17
- ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
18
- create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
19
- };
20
- }>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
21
- readonly destroyed: Schema.Boolean;
22
- }>>, Schema.toCodecJson<typeof UnknownError>, never, never>, false>;
@@ -1,27 +0,0 @@
1
- import { Workspace } from "@opencode/schema/workspace";
2
- import { Schema } from "effect";
3
- import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
4
- import { ConflictError, ProviderNotFoundError, UnknownError } from "../errors.js";
5
- export const WorkspaceGroup = HttpApiGroup.make("server.workspace")
6
- .add(HttpApiEndpoint.post("workspace.create", "/api/workspace", {
7
- payload: Schema.Struct({
8
- id: Workspace.ID.pipe(Schema.optional),
9
- provider: Schema.String,
10
- }),
11
- success: Schema.Struct({ data: Workspace.ID }),
12
- error: [ConflictError, ProviderNotFoundError],
13
- }).annotateMerge(OpenApi.annotations({
14
- identifier: "workspace.create",
15
- summary: "Create workspace",
16
- description: "Create a logical workspace. A caller-supplied ID is idempotent when retried with the same provider; reusing it with another provider returns a conflict.",
17
- })))
18
- .add(HttpApiEndpoint.delete("workspace.destroy", "/api/workspace/:workspaceID", {
19
- params: { workspaceID: Workspace.ID },
20
- success: Workspace.DestroyResult,
21
- error: UnknownError,
22
- }).annotateMerge(OpenApi.annotations({
23
- identifier: "workspace.destroy",
24
- summary: "Destroy workspace",
25
- description: "Make a workspace not exist. This operation is idempotent: an already-missing workspace succeeds with `destroyed: false`, while a workspace removed by this request returns `destroyed: true`.",
26
- })))
27
- .annotateMerge(OpenApi.annotations({ title: "workspace", description: "Workspace lifecycle routes." }));