@opencode/protocol 0.0.0-dev-21131 → 0.0.0-dev-21132

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.
@@ -5,7 +5,7 @@ export declare const SessionMessagesQuery: Schema.Struct<{
5
5
  readonly limit: Schema.optional<Schema.NumberFromString>;
6
6
  readonly order: Schema.optional<Schema.Union<readonly [Schema.Literal<"asc">, Schema.Literal<"desc">]>>;
7
7
  readonly cursor: Schema.optional<Schema.String>;
8
- readonly type: Schema.optional<Schema.Literals<("agent-switched" | "assistant" | "compaction" | "location-switched" | "model-switched" | "shell" | "skill" | "synthetic" | "system" | "user")[]>>;
8
+ readonly type: Schema.optional<Schema.Literals<readonly ("agent-switched" | "assistant" | "compaction" | "idle" | "location-switched" | "model-switched" | "shell" | "skill" | "synthetic" | "system" | "user")[]>>;
9
9
  }>;
10
10
  export declare const PublicSessionMessage: Schema.Union<readonly [Schema.Struct<{
11
11
  readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
@@ -754,7 +754,7 @@ export declare const MessageGroup: HttpApiGroup.HttpApiGroup<"server.message", H
754
754
  readonly limit: Schema.optional<Schema.NumberFromString>;
755
755
  readonly order: Schema.optional<Schema.Union<readonly [Schema.Literal<"asc">, Schema.Literal<"desc">]>>;
756
756
  readonly cursor: Schema.optional<Schema.String>;
757
- readonly type: Schema.optional<Schema.Literals<("agent-switched" | "assistant" | "compaction" | "location-switched" | "model-switched" | "shell" | "skill" | "synthetic" | "system" | "user")[]>>;
757
+ readonly type: Schema.optional<Schema.Literals<readonly ("agent-switched" | "assistant" | "compaction" | "idle" | "location-switched" | "model-switched" | "shell" | "skill" | "synthetic" | "system" | "user")[]>>;
758
758
  }>>, never, never, Schema.toCodecJson<Schema.Struct<{
759
759
  readonly data: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
760
760
  readonly id: Schema.brand<Schema.String, "Session.Message.ID"> & {
@@ -4,6 +4,20 @@ import { Location } from "@opencode/schema/location";
4
4
  import { Schema, Struct } from "effect";
5
5
  import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/http-api";
6
6
  import { InvalidCursorError, SessionNotFoundError, UnknownError } from "../errors.js";
7
+ // Keyed by message type so a new message type cannot be left out of the filter.
8
+ const MessageTypes = {
9
+ "agent-switched": true,
10
+ "model-switched": true,
11
+ "location-switched": true,
12
+ user: true,
13
+ synthetic: true,
14
+ system: true,
15
+ skill: true,
16
+ shell: true,
17
+ assistant: true,
18
+ compaction: true,
19
+ idle: true,
20
+ };
7
21
  export const SessionMessagesQuery = Schema.Struct({
8
22
  limit: Schema.optional(Schema.NumberFromString.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(1), Schema.isLessThanOrEqualTo(200))).annotate({
9
23
  description: "Maximum number of messages to return. When omitted, the endpoint returns its default page size.",
@@ -14,18 +28,7 @@ export const SessionMessagesQuery = Schema.Struct({
14
28
  cursor: Schema.optional(Schema.String.annotate({
15
29
  description: "Opaque pagination cursor returned as cursor.previous or cursor.next in the previous response. Do not combine with order.",
16
30
  })),
17
- type: Schema.optional(Schema.Literals([
18
- "agent-switched",
19
- "model-switched",
20
- "location-switched",
21
- "user",
22
- "synthetic",
23
- "system",
24
- "skill",
25
- "shell",
26
- "assistant",
27
- "compaction",
28
- ])).annotate({
31
+ type: Schema.optional(Schema.Literals(Object.keys(MessageTypes))).annotate({
29
32
  description: "Filter by message type before pagination. When omitted, all message types are returned. Pass the same type when following cursors.",
30
33
  }),
31
34
  }).annotate({ identifier: "SessionMessagesQuery" });
@@ -1,7 +1,11 @@
1
1
  import { Context, Schema } from "effect";
2
2
  import { HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from "effect/http-api";
3
3
  import { LocationNotFoundError, PermissionNotFoundError, SessionNotFoundError } from "../errors.js";
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<{
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.saved.remove", "DELETE", "/api/permission/saved/:id", Schema.toCodecStringTree<Schema.Struct<{
5
+ id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
6
+ create: () => string & import("effect/Brand").Brand<"PermissionSaved.ID">;
7
+ };
8
+ }>>, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"permission.request.list", "GET", "/api/permission/request", never, Schema.toCodecStringTree<Schema.Struct<{
5
9
  readonly location: Schema.optional<Schema.Struct<{
6
10
  readonly directory: Schema.optional<Schema.String>;
7
11
  }>>;
@@ -51,11 +55,7 @@ export declare const makePermissionGroup: <LocationId extends HttpApiMiddleware.
51
55
  readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
52
56
  }>;
53
57
  }>>;
54
- }>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"permission.saved.remove", "DELETE", "/api/permission/saved/:id", Schema.toCodecStringTree<Schema.Struct<{
55
- id: Schema.brand<Schema.String, "PermissionSaved.ID"> & {
56
- create: () => string & import("effect/Brand").Brand<"PermissionSaved.ID">;
57
- };
58
- }>>, 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<{
58
+ }>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"session.permission.create", "POST", "/api/session/:sessionID/permission", Schema.toCodecStringTree<Schema.Struct<{
59
59
  sessionID: Schema.brand<Schema.String, "SessionID"> & {
60
60
  create: () => string & import("effect/Brand").Brand<"SessionID">;
61
61
  descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
@@ -6,7 +6,7 @@ export declare const PTY_CONNECT_TOKEN_HEADER = "x-opencode-ticket";
6
6
  export declare const PTY_CONNECT_TOKEN_HEADER_VALUE = "1";
7
7
  export declare const PTY_CONNECT_PATH = "/api/pty/:ptyID/connect";
8
8
  export declare function hasPtyConnectTicketURL(url: URL): boolean;
9
- export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService>(locationMiddleware: Context.Key<LocationId, LocationService>) => HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEndpoint.HttpApiEndpoint<"pty.connectToken", "POST", "/api/pty/:ptyID/connect-token", Schema.toCodecStringTree<Schema.Struct<{
9
+ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService>(locationMiddleware: Context.Key<LocationId, LocationService>) => HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEndpoint.HttpApiEndpoint<"pty.remove", "DELETE", "/api/pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
10
10
  ptyID: Schema.brand<Schema.String, "PtyID"> & {
11
11
  create: () => string & import("effect/Brand").Brand<"PtyID">;
12
12
  ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
@@ -15,31 +15,15 @@ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId,
15
15
  readonly location: Schema.optional<Schema.Struct<{
16
16
  readonly directory: Schema.optional<Schema.String>;
17
17
  }>>;
18
- }>>, never, Schema.toCodecStringTree<Schema.Struct<{
19
- readonly "x-opencode-ticket": Schema.optional<Schema.String>;
20
- }>>, Schema.toCodecJson<Schema.Struct<{
21
- readonly location: Schema.Struct<{
22
- readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
23
- }>;
24
- readonly data: Schema.Struct<{
25
- readonly ticket: Schema.String;
26
- readonly expires_in: Schema.Int;
27
- }>;
28
- }>>, Schema.toCodecJson<typeof ForbiddenError | typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.create", "POST", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
18
+ }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.list", "GET", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
29
19
  readonly location: Schema.optional<Schema.Struct<{
30
20
  readonly directory: Schema.optional<Schema.String>;
31
21
  }>>;
32
- }>>, Schema.toCodecJson<Schema.Struct<{
33
- readonly command: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
34
- readonly args: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
35
- readonly cwd: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
36
- readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
37
- readonly env: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
38
- }>>, never, Schema.toCodecJson<Schema.Struct<{
22
+ }>>, never, never, Schema.toCodecJson<Schema.Struct<{
39
23
  readonly location: Schema.Struct<{
40
24
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
41
25
  }>;
42
- readonly data: Schema.Struct<{
26
+ readonly data: Schema.$Array<Schema.Struct<{
43
27
  readonly id: Schema.brand<Schema.String, "PtyID"> & {
44
28
  create: () => string & import("effect/Brand").Brand<"PtyID">;
45
29
  ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
@@ -51,7 +35,7 @@ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId,
51
35
  readonly status: Schema.Literals<readonly ["running", "exited"]>;
52
36
  readonly pid: Schema.Int;
53
37
  readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
54
- }>;
38
+ }>>;
55
39
  }>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.get", "GET", "/api/pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
56
40
  ptyID: Schema.brand<Schema.String, "PtyID"> & {
57
41
  create: () => string & import("effect/Brand").Brand<"PtyID">;
@@ -78,15 +62,40 @@ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId,
78
62
  readonly pid: Schema.Int;
79
63
  readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
80
64
  }>;
81
- }>>, Schema.toCodecJson<typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.list", "GET", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
65
+ }>>, Schema.toCodecJson<typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.connectToken", "POST", "/api/pty/:ptyID/connect-token", Schema.toCodecStringTree<Schema.Struct<{
66
+ ptyID: Schema.brand<Schema.String, "PtyID"> & {
67
+ create: () => string & import("effect/Brand").Brand<"PtyID">;
68
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
69
+ };
70
+ }>>, Schema.toCodecStringTree<Schema.Struct<{
82
71
  readonly location: Schema.optional<Schema.Struct<{
83
72
  readonly directory: Schema.optional<Schema.String>;
84
73
  }>>;
85
- }>>, never, never, Schema.toCodecJson<Schema.Struct<{
74
+ }>>, never, Schema.toCodecStringTree<Schema.Struct<{
75
+ readonly "x-opencode-ticket": Schema.optional<Schema.String>;
76
+ }>>, Schema.toCodecJson<Schema.Struct<{
86
77
  readonly location: Schema.Struct<{
87
78
  readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
88
79
  }>;
89
- readonly data: Schema.$Array<Schema.Struct<{
80
+ readonly data: Schema.Struct<{
81
+ readonly ticket: Schema.String;
82
+ readonly expires_in: Schema.Int;
83
+ }>;
84
+ }>>, Schema.toCodecJson<typeof ForbiddenError | typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.create", "POST", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
85
+ readonly location: Schema.optional<Schema.Struct<{
86
+ readonly directory: Schema.optional<Schema.String>;
87
+ }>>;
88
+ }>>, Schema.toCodecJson<Schema.Struct<{
89
+ readonly command: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
90
+ readonly args: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
91
+ readonly cwd: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
92
+ readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
93
+ readonly env: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
94
+ }>>, never, Schema.toCodecJson<Schema.Struct<{
95
+ readonly location: Schema.Struct<{
96
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
97
+ }>;
98
+ readonly data: Schema.Struct<{
90
99
  readonly id: Schema.brand<Schema.String, "PtyID"> & {
91
100
  create: () => string & import("effect/Brand").Brand<"PtyID">;
92
101
  ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
@@ -98,17 +107,8 @@ export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId,
98
107
  readonly status: Schema.Literals<readonly ["running", "exited"]>;
99
108
  readonly pid: Schema.Int;
100
109
  readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
101
- }>>;
102
- }>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.remove", "DELETE", "/api/pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
103
- ptyID: Schema.brand<Schema.String, "PtyID"> & {
104
- create: () => string & import("effect/Brand").Brand<"PtyID">;
105
- ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
106
- };
107
- }>>, Schema.toCodecStringTree<Schema.Struct<{
108
- readonly location: Schema.optional<Schema.Struct<{
109
- readonly directory: Schema.optional<Schema.String>;
110
- }>>;
111
- }>>, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof PtyNotFoundError>, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.update", "PUT", "/api/pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
110
+ }>;
111
+ }>>, never, LocationId, HttpApiMiddleware.Requires<LocationId>> | HttpApiEndpoint.HttpApiEndpoint<"pty.update", "PUT", "/api/pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
112
112
  ptyID: Schema.brand<Schema.String, "PtyID"> & {
113
113
  create: () => string & import("effect/Brand").Brand<"PtyID">;
114
114
  ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
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-21131",
4
+ "version": "0.0.0-dev-21132",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -33,7 +33,7 @@
33
33
  "typecheck": "tsc --noEmit"
34
34
  },
35
35
  "dependencies": {
36
- "@opencode/schema": "0.0.0-dev-21131",
36
+ "@opencode/schema": "0.0.0-dev-21132",
37
37
  "effect": "4.0.1"
38
38
  },
39
39
  "devDependencies": {