@opencode/protocol 2.0.21 → 2.0.23

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/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { InvalidRequestError, SessionNotFoundError } from "./errors.js";
1
+ import { LocationNotFoundError, InvalidRequestError, SessionNotFoundError } from "./errors.js";
2
2
  import type { Api } from "./api.js";
3
3
  import type { Context } from "effect";
4
4
  import { HttpApiMiddleware } from "effect/unstable/httpapi";
@@ -6,21 +6,21 @@ import type { EventGroup } from "./groups/event.js";
6
6
  declare const LocationMiddleware_base: HttpApiMiddleware.ServiceClass<LocationMiddleware, "@opencode/client/LocationMiddleware", {
7
7
  requires: never;
8
8
  provides: never;
9
- error: never;
9
+ error: readonly [typeof LocationNotFoundError];
10
10
  clientError: never;
11
11
  requiredForClient: false;
12
12
  security: never;
13
- }, HttpApiMiddleware.HttpApiMiddleware<never, never, never>>;
13
+ }, HttpApiMiddleware.HttpApiMiddleware<never, readonly [typeof LocationNotFoundError], never>>;
14
14
  declare class LocationMiddleware extends LocationMiddleware_base {
15
15
  }
16
16
  declare const SessionLocationMiddleware_base: HttpApiMiddleware.ServiceClass<SessionLocationMiddleware, "@opencode/client/SessionLocationMiddleware", {
17
17
  requires: never;
18
18
  provides: never;
19
- error: readonly [typeof InvalidRequestError, typeof SessionNotFoundError];
19
+ error: readonly [typeof InvalidRequestError, typeof SessionNotFoundError, typeof LocationNotFoundError];
20
20
  clientError: never;
21
21
  requiredForClient: false;
22
22
  security: never;
23
- }, HttpApiMiddleware.HttpApiMiddleware<never, readonly [typeof InvalidRequestError, typeof SessionNotFoundError], never>>;
23
+ }, HttpApiMiddleware.HttpApiMiddleware<never, readonly [typeof InvalidRequestError, typeof SessionNotFoundError, typeof LocationNotFoundError], never>>;
24
24
  declare class SessionLocationMiddleware extends SessionLocationMiddleware_base {
25
25
  }
26
26
  type ClientApiShape = Api<Context.Service.Identifier<typeof LocationMiddleware>, Context.Service.Shape<typeof LocationMiddleware>, Context.Service.Identifier<typeof SessionLocationMiddleware>, Context.Service.Shape<typeof SessionLocationMiddleware>, Context.Service.Identifier<typeof SessionLocationMiddleware>, Context.Service.Shape<typeof SessionLocationMiddleware>, typeof EventGroup>;
package/dist/client.js CHANGED
@@ -1,9 +1,9 @@
1
- import { InvalidRequestError, SessionNotFoundError } from "./errors.js";
1
+ import { LocationNotFoundError, InvalidRequestError, SessionNotFoundError } from "./errors.js";
2
2
  import { makeDefaultApi } from "./api.js";
3
3
  import { HttpApiMiddleware } from "effect/unstable/httpapi";
4
- class LocationMiddleware extends HttpApiMiddleware.Service()("@opencode/client/LocationMiddleware") {
4
+ class LocationMiddleware extends HttpApiMiddleware.Service()("@opencode/client/LocationMiddleware", { error: [LocationNotFoundError] }) {
5
5
  }
6
- class SessionLocationMiddleware extends HttpApiMiddleware.Service()("@opencode/client/SessionLocationMiddleware", { error: [InvalidRequestError, SessionNotFoundError] }) {
6
+ class SessionLocationMiddleware extends HttpApiMiddleware.Service()("@opencode/client/SessionLocationMiddleware", { error: [InvalidRequestError, SessionNotFoundError, LocationNotFoundError] }) {
7
7
  }
8
8
  export const ClientApi = makeDefaultApi({
9
9
  locationMiddleware: LocationMiddleware,
package/dist/errors.d.ts CHANGED
@@ -1,4 +1,12 @@
1
1
  import { Schema } from "effect";
2
+ declare const LocationNotFoundError_base: Schema.Class<LocationNotFoundError, Schema.TaggedStruct<"LocationNotFoundError", {
3
+ readonly location: Schema.Struct<{
4
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
5
+ }>;
6
+ readonly message: Schema.String;
7
+ }>, import("effect/Cause").YieldableError>;
8
+ export declare class LocationNotFoundError extends LocationNotFoundError_base {
9
+ }
2
10
  declare const InvalidRequestError_base: Schema.Class<InvalidRequestError, Schema.TaggedStruct<"InvalidRequestError", {
3
11
  readonly message: Schema.String;
4
12
  readonly kind: Schema.optional<Schema.String>;
package/dist/errors.js CHANGED
@@ -1,5 +1,8 @@
1
1
  import { Schema } from "effect";
2
2
  import { Skill } from "@opencode/schema/skill";
3
+ import { Location } from "@opencode/schema/location";
4
+ export class LocationNotFoundError extends Schema.TaggedError()("LocationNotFoundError", { location: Location.PublicRef, message: Schema.String }, { httpApiStatus: 404 }) {
5
+ }
3
6
  export class InvalidRequestError extends Schema.TaggedError()("InvalidRequestError", {
4
7
  message: Schema.String,
5
8
  kind: Schema.optional(Schema.String),
@@ -61,7 +61,8 @@ export declare const AgentGroup: HttpApiGroup.HttpApiGroup<"server.agent", HttpA
61
61
  readonly request: Schema.Struct<{
62
62
  readonly settings: Schema.withConstructorDefault<Schema.StructWithRest<Schema.Struct<{
63
63
  readonly timeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
64
- readonly chunkTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
64
+ readonly headerTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
65
+ readonly chunkTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
65
66
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
66
67
  readonly type: Schema.Literal<"summary">;
67
68
  }>, Schema.Struct<{
@@ -170,7 +171,8 @@ export declare const AgentGroup: HttpApiGroup.HttpApiGroup<"server.agent", HttpA
170
171
  readonly request: Schema.Struct<{
171
172
  readonly settings: Schema.withConstructorDefault<Schema.StructWithRest<Schema.Struct<{
172
173
  readonly timeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
173
- readonly chunkTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
174
+ readonly headerTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
175
+ readonly chunkTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
174
176
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
175
177
  readonly type: Schema.Literal<"summary">;
176
178
  }>, Schema.Struct<{
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
3
- import { InvalidRequestError, ServiceUnavailableError } from "../errors.js";
3
+ import { LocationNotFoundError, InvalidRequestError, ServiceUnavailableError } from "../errors.js";
4
4
  export declare const GenerateGroup: HttpApiGroup.HttpApiGroup<"server.generate", HttpApiEndpoint.HttpApiEndpoint<"generate.text", "POST", "/api/experimental/generate", never, never, Schema.toCodecJson<Schema.Struct<{
5
5
  readonly prompt: Schema.String;
6
6
  readonly model: Schema.optional<Schema.Struct<{
@@ -30,4 +30,4 @@ export declare const GenerateGroup: HttpApiGroup.HttpApiGroup<"server.generate",
30
30
  readonly data: Schema.Struct<{
31
31
  readonly text: Schema.String;
32
32
  }>;
33
- }>>, Schema.toCodecJson<typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never>, false>;
33
+ }>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never>, false>;
@@ -1,7 +1,7 @@
1
1
  import { Model } from "@opencode/schema/model";
2
2
  import { Schema } from "effect";
3
3
  import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
4
- import { InvalidRequestError, ServiceUnavailableError } from "../errors.js";
4
+ import { LocationNotFoundError, InvalidRequestError, ServiceUnavailableError } from "../errors.js";
5
5
  export const GenerateGroup = HttpApiGroup.make("server.generate")
6
6
  .add(HttpApiEndpoint.post("generate.text", "/api/experimental/generate", {
7
7
  payload: Schema.Struct({
@@ -11,7 +11,7 @@ export const GenerateGroup = HttpApiGroup.make("server.generate")
11
11
  success: Schema.Struct({
12
12
  data: Schema.Struct({ text: Schema.String }),
13
13
  }).annotate({ identifier: "GenerateTextResponse" }),
14
- error: [InvalidRequestError, ServiceUnavailableError],
14
+ error: [InvalidRequestError, ServiceUnavailableError, LocationNotFoundError],
15
15
  }).annotateMerge(OpenApi.annotations({
16
16
  identifier: "experimental.generate.text",
17
17
  summary: "Generate text",
@@ -1,6 +1,6 @@
1
1
  import { Context, Schema } from "effect";
2
2
  import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from "effect/unstable/httpapi";
3
- import { PermissionNotFoundError, SessionNotFoundError } from "../errors.js";
3
+ import { LocationNotFoundError, PermissionNotFoundError, SessionNotFoundError } from "../errors.js";
4
4
  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<{
5
5
  readonly location: Schema.optional<Schema.Struct<{
6
6
  readonly directory: Schema.optional<Schema.String>;
@@ -114,7 +114,7 @@ export declare const makePermissionGroup: <LocationId extends HttpApiMiddleware.
114
114
  create: (id?: string) => string & import("effect/Brand").Brand<"Permission.ID">;
115
115
  };
116
116
  }>>;
117
- }>>, Schema.toCodecJson<typeof SessionNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"session.permission.get", "GET", "/api/session/:sessionID/permission/:requestID", Schema.toCodecStringTree<Schema.Struct<{
117
+ }>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof SessionNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"session.permission.get", "GET", "/api/session/:sessionID/permission/:requestID", Schema.toCodecStringTree<Schema.Struct<{
118
118
  sessionID: Schema.brand<Schema.String, "SessionID"> & {
119
119
  create: () => string & import("effect/Brand").Brand<"SessionID">;
120
120
  descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
@@ -6,7 +6,7 @@ import { Project } from "@opencode/schema/project";
6
6
  import { Session } from "@opencode/schema/session";
7
7
  import { Context, Schema } from "effect";
8
8
  import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
9
- import { PermissionNotFoundError, SessionNotFoundError } from "../errors.js";
9
+ import { LocationNotFoundError, PermissionNotFoundError, SessionNotFoundError } from "../errors.js";
10
10
  import { LocationQuery, locationQueryOpenApi } from "./location.js";
11
11
  export const makePermissionGroup = (locationMiddleware, sessionLocationMiddleware) => HttpApiGroup.make("server.permission")
12
12
  .add(HttpApiEndpoint.get("permission.request.list", "/api/permission/request", {
@@ -62,7 +62,7 @@ export const makePermissionGroup = (locationMiddleware, sessionLocationMiddlewar
62
62
  .add(HttpApiEndpoint.get("session.permission.list", "/api/session/:sessionID/permission", {
63
63
  params: { sessionID: Session.ID },
64
64
  success: Schema.Struct({ data: Schema.Array(Permission.Request) }),
65
- error: SessionNotFoundError,
65
+ error: [SessionNotFoundError, LocationNotFoundError],
66
66
  }).annotateMerge(OpenApi.annotations({
67
67
  identifier: "session.permission.list",
68
68
  summary: "List session permission requests",
@@ -13,7 +13,8 @@ export declare const ProviderGroup: HttpApiGroup.HttpApiGroup<"server.provider",
13
13
  readonly data: Schema.$Array<Schema.Struct<{
14
14
  readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.StructWithRest<Schema.Struct<{
15
15
  readonly timeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
16
- readonly chunkTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
16
+ readonly headerTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
17
+ readonly chunkTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
17
18
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
18
19
  readonly type: Schema.Literal<"summary">;
19
20
  }>, Schema.Struct<{
@@ -26,7 +27,8 @@ export declare const ProviderGroup: HttpApiGroup.HttpApiGroup<"server.provider",
26
27
  readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
27
28
  }>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
28
29
  readonly timeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
29
- readonly chunkTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
30
+ readonly headerTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
31
+ readonly chunkTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
30
32
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
31
33
  readonly type: Schema.Literal<"summary">;
32
34
  }>, Schema.Struct<{
@@ -110,7 +112,8 @@ export declare const ProviderGroup: HttpApiGroup.HttpApiGroup<"server.provider",
110
112
  readonly data: Schema.Struct<{
111
113
  readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.StructWithRest<Schema.Struct<{
112
114
  readonly timeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
113
- readonly chunkTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
115
+ readonly headerTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
116
+ readonly chunkTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
114
117
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
115
118
  readonly type: Schema.Literal<"summary">;
116
119
  }>, Schema.Struct<{
@@ -123,7 +126,8 @@ export declare const ProviderGroup: HttpApiGroup.HttpApiGroup<"server.provider",
123
126
  readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
124
127
  }>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
125
128
  readonly timeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
126
- readonly chunkTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
129
+ readonly headerTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
130
+ readonly chunkTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
127
131
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
128
132
  readonly type: Schema.Literal<"summary">;
129
133
  }>, Schema.Struct<{
@@ -8,6 +8,9 @@ export declare const ServerInfo: Schema.Struct<{
8
8
  readonly paths: Schema.Struct<{
9
9
  readonly tmp: Schema.String;
10
10
  }>;
11
+ readonly capabilities: Schema.optional<Schema.Struct<{
12
+ readonly persistentPty: Schema.optional<Schema.Boolean>;
13
+ }>>;
11
14
  }>;
12
15
  export type ServerInfo = typeof ServerInfo.Type;
13
16
  export declare const PairingCode: Schema.Struct<{
@@ -27,6 +30,9 @@ export declare const ServerGroup: HttpApiGroup.HttpApiGroup<"server.server", Htt
27
30
  readonly paths: Schema.Struct<{
28
31
  readonly tmp: Schema.String;
29
32
  }>;
33
+ readonly capabilities: Schema.optional<Schema.Struct<{
34
+ readonly persistentPty: Schema.optional<Schema.Boolean>;
35
+ }>>;
30
36
  }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"server.pair", "POST", "/api/pair", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
31
37
  readonly code: Schema.String;
32
38
  readonly expires_in: Schema.Int;
@@ -9,6 +9,10 @@ export const ServerInfo = Schema.Struct({
9
9
  paths: Schema.Struct({
10
10
  tmp: Schema.String,
11
11
  }),
12
+ // Optional at every level so clients still decode servers that predate a capability.
13
+ capabilities: Schema.optional(Schema.Struct({
14
+ persistentPty: Schema.optional(Schema.Boolean),
15
+ })),
12
16
  }).annotate({ identifier: "ServerInfo" });
13
17
  export const PairingCode = Schema.Struct({
14
18
  code: Schema.String,
@@ -3,8 +3,7 @@ import { InstructionEntry } from "@opencode/schema/instruction-entry";
3
3
  import { Event } from "@opencode/schema/event";
4
4
  import { Context, Effect, Schema } from "effect";
5
5
  import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from "effect/unstable/httpapi";
6
- import { ConflictError, CommandExecutionError, CommandNotFoundError, FormAlreadySettledError, FormInvalidAnswerError, FormNotFoundError, InvalidCursorError, InvalidRequestError, MessageNotFoundError, ServiceUnavailableError, SessionBusyError, SessionNotFoundError, SkillNotFoundError, UnknownError } from "../errors.js";
7
- import { SessionEvent } from "@opencode/schema/session-event";
6
+ import { ConflictError, LocationNotFoundError, CommandExecutionError, CommandNotFoundError, FormAlreadySettledError, FormInvalidAnswerError, FormNotFoundError, InvalidCursorError, InvalidRequestError, MessageNotFoundError, ServiceUnavailableError, SessionBusyError, SessionNotFoundError, SkillNotFoundError, UnknownError } from "../errors.js";
8
7
  declare const SessionsCursorInput: Schema.Union<readonly [Schema.Struct<{
9
8
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
10
9
  readonly parentID: Schema.optional<Schema.Union<readonly [Schema.brand<Schema.String, "SessionID"> & {
@@ -473,6 +472,10 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
473
472
  create: () => string & import("effect/Brand").Brand<"SessionID">;
474
473
  descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
475
474
  }>;
475
+ readonly parentID: Schema.optional<Schema.brand<Schema.String, "SessionID"> & {
476
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
477
+ descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
478
+ }>;
476
479
  readonly title: Schema.optional<Schema.String>;
477
480
  readonly agent: Schema.optional<Schema.brand<Schema.String, "Agent.ID">>;
478
481
  readonly model: Schema.optional<Schema.Struct<{
@@ -683,7 +686,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
683
686
  }>]>;
684
687
  }>>, never, never>;
685
688
  }>;
686
- }>>, never, never, never> | HttpApiEndpoint.HttpApiEndpoint<"session.import", "POST", "/api/experimental/session/import", never, never, Schema.toCodecJson<Schema.Struct<{
689
+ }>>, Schema.toCodecJson<typeof SessionNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"session.import", "POST", "/api/experimental/session/import", never, never, Schema.toCodecJson<Schema.Struct<{
687
690
  readonly location: Schema.optional<Schema.Struct<{
688
691
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
689
692
  }>>;
@@ -1005,7 +1008,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
1005
1008
  readonly text: Schema.String;
1006
1009
  }>>, never, never>;
1007
1010
  }> & {
1008
- create: (input: SessionEvent.FileAttachment) => {
1011
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
1009
1012
  readonly data: string;
1010
1013
  readonly source: {
1011
1014
  readonly type: "inline";
@@ -1043,7 +1046,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
1043
1046
  readonly text: Schema.String;
1044
1047
  }>>, never, never>;
1045
1048
  }> & {
1046
- create: (input: SessionEvent.FileAttachment) => {
1049
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
1047
1050
  readonly data: string;
1048
1051
  readonly source: {
1049
1052
  readonly type: "inline";
@@ -2084,7 +2087,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
2084
2087
  readonly text: Schema.String;
2085
2088
  }>>, never, never>;
2086
2089
  }> & {
2087
- create: (input: SessionEvent.FileAttachment) => {
2090
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
2088
2091
  readonly data: string;
2089
2092
  readonly source: {
2090
2093
  readonly type: "inline";
@@ -2122,7 +2125,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
2122
2125
  readonly text: Schema.String;
2123
2126
  }>>, never, never>;
2124
2127
  }> & {
2125
- create: (input: SessionEvent.FileAttachment) => {
2128
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
2126
2129
  readonly data: string;
2127
2130
  readonly source: {
2128
2131
  readonly type: "inline";
@@ -3233,7 +3236,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
3233
3236
  readonly text: Schema.String;
3234
3237
  }>>, never, never>;
3235
3238
  }> & {
3236
- create: (input: SessionEvent.FileAttachment) => {
3239
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
3237
3240
  readonly data: string;
3238
3241
  readonly source: {
3239
3242
  readonly type: "inline";
@@ -3271,7 +3274,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
3271
3274
  readonly text: Schema.String;
3272
3275
  }>>, never, never>;
3273
3276
  }> & {
3274
- create: (input: SessionEvent.FileAttachment) => {
3277
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
3275
3278
  readonly data: string;
3276
3279
  readonly source: {
3277
3280
  readonly type: "inline";
@@ -3737,7 +3740,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
3737
3740
  readonly text: Schema.String;
3738
3741
  }>>, never, never>;
3739
3742
  }> & {
3740
- create: (input: SessionEvent.FileAttachment) => {
3743
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
3741
3744
  readonly data: string;
3742
3745
  readonly source: {
3743
3746
  readonly type: "inline";
@@ -3775,7 +3778,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
3775
3778
  readonly text: Schema.String;
3776
3779
  }>>, never, never>;
3777
3780
  }> & {
3778
- create: (input: SessionEvent.FileAttachment) => {
3781
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
3779
3782
  readonly data: string;
3780
3783
  readonly source: {
3781
3784
  readonly type: "inline";
@@ -4336,7 +4339,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
4336
4339
  readonly deletions: Schema.Int;
4337
4340
  readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
4338
4341
  }>>;
4339
- }>>, Schema.toCodecJson<typeof InvalidRequestError | typeof UnknownError | typeof SessionNotFoundError | typeof MessageNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"session.inbox.list", "GET", "/api/session/:sessionID/inbox", Schema.toCodecStringTree<Schema.Struct<{
4342
+ }>>, Schema.toCodecJson<typeof LocationNotFoundError | typeof InvalidRequestError | typeof UnknownError | typeof SessionNotFoundError | typeof MessageNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"session.inbox.list", "GET", "/api/session/:sessionID/inbox", Schema.toCodecStringTree<Schema.Struct<{
4340
4343
  sessionID: Schema.brand<Schema.String, "SessionID"> & {
4341
4344
  create: () => string & import("effect/Brand").Brand<"SessionID">;
4342
4345
  descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
@@ -4368,7 +4371,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
4368
4371
  readonly text: Schema.String;
4369
4372
  }>>, never, never>;
4370
4373
  }> & {
4371
- create: (input: SessionEvent.FileAttachment) => {
4374
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
4372
4375
  readonly data: string;
4373
4376
  readonly source: {
4374
4377
  readonly type: "inline";
@@ -4406,7 +4409,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
4406
4409
  readonly text: Schema.String;
4407
4410
  }>>, never, never>;
4408
4411
  }> & {
4409
- create: (input: SessionEvent.FileAttachment) => {
4412
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
4410
4413
  readonly data: string;
4411
4414
  readonly source: {
4412
4415
  readonly type: "inline";
@@ -5622,7 +5625,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
5622
5625
  readonly text: Schema.String;
5623
5626
  }>>, never, never>;
5624
5627
  }> & {
5625
- create: (input: SessionEvent.FileAttachment) => {
5628
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
5626
5629
  readonly data: string;
5627
5630
  readonly source: {
5628
5631
  readonly type: "inline";
@@ -5660,7 +5663,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
5660
5663
  readonly text: Schema.String;
5661
5664
  }>>, never, never>;
5662
5665
  }> & {
5663
- create: (input: SessionEvent.FileAttachment) => {
5666
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
5664
5667
  readonly data: string;
5665
5668
  readonly source: {
5666
5669
  readonly type: "inline";
@@ -5805,7 +5808,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
5805
5808
  readonly text: Schema.String;
5806
5809
  }>>, never, never>;
5807
5810
  }> & {
5808
- create: (input: SessionEvent.FileAttachment) => {
5811
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
5809
5812
  readonly data: string;
5810
5813
  readonly source: {
5811
5814
  readonly type: "inline";
@@ -5843,7 +5846,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
5843
5846
  readonly text: Schema.String;
5844
5847
  }>>, never, never>;
5845
5848
  }> & {
5846
- create: (input: SessionEvent.FileAttachment) => {
5849
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
5847
5850
  readonly data: string;
5848
5851
  readonly source: {
5849
5852
  readonly type: "inline";
@@ -10323,7 +10326,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
10323
10326
  readonly text: Schema.String;
10324
10327
  }>>, never, never>;
10325
10328
  }> & {
10326
- create: (input: SessionEvent.FileAttachment) => {
10329
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
10327
10330
  readonly data: string;
10328
10331
  readonly source: {
10329
10332
  readonly type: "inline";
@@ -10361,7 +10364,7 @@ export declare const makeSessionGroup: <I extends HttpApiMiddleware.AnyId, S, Fo
10361
10364
  readonly text: Schema.String;
10362
10365
  }>>, never, never>;
10363
10366
  }> & {
10364
- create: (input: SessionEvent.FileAttachment) => {
10367
+ create: (input: import("@opencode/schema/prompt").FileAttachment) => {
10365
10368
  readonly data: string;
10366
10369
  readonly source: {
10367
10370
  readonly type: "inline";
@@ -9,7 +9,7 @@ import { AbsolutePath, DateTimeUtcFromMillis, NonNegativeInt, PositiveInt, Relat
9
9
  import { Event } from "@opencode/schema/event";
10
10
  import { Context, Effect, Encoding, Result, Schema, SchemaGetter, Struct } from "effect";
11
11
  import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
12
- import { ConflictError, CommandExecutionError, CommandNotFoundError, FormAlreadySettledError, FormInvalidAnswerError, FormNotFoundError, InvalidCursorError, InvalidRequestError, MessageNotFoundError, ServiceUnavailableError, SessionBusyError, SessionNotFoundError, SkillNotFoundError, UnknownError, } from "../errors.js";
12
+ import { ConflictError, LocationNotFoundError, CommandExecutionError, CommandNotFoundError, FormAlreadySettledError, FormInvalidAnswerError, FormNotFoundError, InvalidCursorError, InvalidRequestError, MessageNotFoundError, ServiceUnavailableError, SessionBusyError, SessionNotFoundError, SkillNotFoundError, UnknownError, } from "../errors.js";
13
13
  import { Agent } from "@opencode/schema/agent";
14
14
  import { Skill } from "@opencode/schema/skill";
15
15
  import { Model } from "@opencode/schema/model";
@@ -153,6 +153,7 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
153
153
  .add(HttpApiEndpoint.post("session.create", "/api/session", {
154
154
  payload: Schema.Struct({
155
155
  id: Session.ID.pipe(Schema.optional),
156
+ parentID: Session.ID.pipe(Schema.optional),
156
157
  title: Schema.String.pipe(Schema.optional),
157
158
  agent: Agent.ID.pipe(Schema.optional),
158
159
  model: Model.Ref.pipe(Schema.optional),
@@ -161,10 +162,11 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
161
162
  permissions: Permission.Ruleset.pipe(Schema.optional),
162
163
  }),
163
164
  success: Schema.Struct({ data: PublicSessionInfo }),
165
+ error: SessionNotFoundError,
164
166
  }).annotateMerge(OpenApi.annotations({
165
167
  identifier: "session.create",
166
168
  summary: "Create session",
167
- description: "Create a session at the requested location.",
169
+ description: "Create a session at the requested location. A parentID creates a linked child session at its parent's location.",
168
170
  })))
169
171
  .add(HttpApiEndpoint.post("session.import", "/api/experimental/session/import", {
170
172
  payload: Schema.Struct({
@@ -433,7 +435,7 @@ export const makeSessionGroup = (sessionLocationMiddleware, formLocationMiddlewa
433
435
  }),
434
436
  }),
435
437
  success: Schema.Struct({ data: Schema.Array(FileDiff.Info) }),
436
- error: [InvalidRequestError, MessageNotFoundError, SessionNotFoundError, UnknownError],
438
+ error: [InvalidRequestError, MessageNotFoundError, SessionNotFoundError, UnknownError, LocationNotFoundError],
437
439
  }).annotateMerge(OpenApi.annotations({
438
440
  identifier: "session.diff",
439
441
  summary: "Diff session turns",
@@ -1,7 +1,18 @@
1
1
  import { Schema } from "effect";
2
- import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
3
- import { ServiceUnavailableError } from "../errors.js";
4
- export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEndpoint.HttpApiEndpoint<"vcs.get", "GET", "/api/vcs", never, Schema.toCodecStringTree<Schema.Struct<{
2
+ import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
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.init", "POST", "/api/vcs/init", never, Schema.toCodecStringTree<Schema.Struct<{
11
+ readonly provider: Schema.optional<Schema.String>;
12
+ readonly location: Schema.optional<Schema.Struct<{
13
+ readonly directory: Schema.optional<Schema.String>;
14
+ }>>;
15
+ }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof InvalidRequestError | typeof ConflictError | typeof ServiceUnavailableError | typeof VcsInitNotSupportedError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"vcs.get", "GET", "/api/vcs", never, Schema.toCodecStringTree<Schema.Struct<{
5
16
  readonly location: Schema.optional<Schema.Struct<{
6
17
  readonly directory: Schema.optional<Schema.String>;
7
18
  }>>;
@@ -73,3 +84,4 @@ export declare const VcsGroup: HttpApiGroup.HttpApiGroup<"server.vcs", HttpApiEn
73
84
  readonly status: Schema.Literals<readonly ["added", "deleted", "modified"]>;
74
85
  }>>;
75
86
  }>>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never>, false>;
87
+ export {};
@@ -3,9 +3,15 @@ import { Location } from "@opencode/schema/location";
3
3
  import { NonNegativeInt, PositiveInt, optional } from "@opencode/schema/schema";
4
4
  import { Vcs } from "@opencode/schema/vcs";
5
5
  import { Schema } from "effect";
6
- import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi";
6
+ import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
7
7
  import { LocationQuery, locationQueryOpenApi } from "./location.js";
8
- import { ServiceUnavailableError } from "../errors.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
+ }
9
15
  const BranchesQuery = Schema.Struct({
10
16
  ...LocationQuery.fields,
11
17
  search: Schema.optional(Schema.String),
@@ -18,6 +24,17 @@ const DiffQuery = Schema.Struct({
18
24
  context: Schema.NumberFromString.pipe(Schema.decodeTo(NonNegativeInt), Schema.optional),
19
25
  });
20
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
+ })))
21
38
  .add(HttpApiEndpoint.get("vcs.get", "/api/vcs", {
22
39
  query: LocationQuery,
23
40
  success: Location.response(Vcs.Info),
@@ -1,7 +1,7 @@
1
1
  import { Schema } from "effect";
2
2
  import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
3
3
  import { ProjectNotFoundError } from "../errors.js";
4
- declare const WorktreeError_base: Schema.Class<WorktreeError, Schema.Struct<{
4
+ declare const WorktreeError_base: Schema.Class<WorktreeError, Schema.TaggedStruct<"WorktreeError", {
5
5
  readonly name: Schema.Literal<"WorktreeError">;
6
6
  readonly data: Schema.Struct<{
7
7
  readonly message: Schema.String;
@@ -4,7 +4,7 @@ import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/un
4
4
  import { Project } from "@opencode/schema/project";
5
5
  import { ProjectNotFoundError } from "../errors.js";
6
6
  const root = "/api/worktree";
7
- export class WorktreeError extends Schema.Error("WorktreeError")({
7
+ export class WorktreeError extends Schema.TaggedError()("WorktreeError", {
8
8
  name: Schema.Literal("WorktreeError"),
9
9
  data: Schema.Struct({
10
10
  message: Schema.String,
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": "2.0.21",
4
+ "version": "2.0.23",
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": "2.0.21",
35
+ "@opencode/schema": "2.0.23",
36
36
  "effect": "4.0.0-rc.112"
37
37
  },
38
38
  "devDependencies": {