@opencode/protocol 2.0.28 → 2.0.30
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/groups/event.d.ts
CHANGED
|
@@ -6112,14 +6112,14 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
|
|
|
6112
6112
|
}>, never, never>;
|
|
6113
6113
|
}>>, never, never>;
|
|
6114
6114
|
readonly data: Schema.Struct<{
|
|
6115
|
-
readonly command: Schema.Union<readonly [Schema.Literals<readonly ["session.list", "session.new", "session.
|
|
6115
|
+
readonly command: Schema.Union<readonly [Schema.Literals<readonly ["session.list", "session.new", "session.interrupt", "session.background", "session.compact", "session.page.up", "session.page.down", "session.line.up", "session.line.down", "session.half.page.up", "session.half.page.down", "session.first", "session.last", "prompt.clear", "prompt.submit", "agent.cycle"]>, Schema.String]>;
|
|
6116
6116
|
}>;
|
|
6117
6117
|
}> & {
|
|
6118
6118
|
type: "tui.command.execute";
|
|
6119
6119
|
durability: "ephemeral";
|
|
6120
6120
|
durable: undefined;
|
|
6121
6121
|
data: Schema.Struct<{
|
|
6122
|
-
readonly command: Schema.Union<readonly [Schema.Literals<readonly ["session.list", "session.new", "session.
|
|
6122
|
+
readonly command: Schema.Union<readonly [Schema.Literals<readonly ["session.list", "session.new", "session.interrupt", "session.background", "session.compact", "session.page.up", "session.page.down", "session.line.up", "session.line.down", "session.half.page.up", "session.half.page.down", "session.first", "session.last", "prompt.clear", "prompt.submit", "agent.cycle"]>, Schema.String]>;
|
|
6123
6123
|
}>;
|
|
6124
6124
|
}, Schema.Struct<{
|
|
6125
6125
|
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
@@ -14749,14 +14749,14 @@ export declare const OpenCodeEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
14749
14749
|
}>, never, never>;
|
|
14750
14750
|
}>>, never, never>;
|
|
14751
14751
|
readonly data: Schema.Struct<{
|
|
14752
|
-
readonly command: Schema.Union<readonly [Schema.Literals<readonly ["session.list", "session.new", "session.
|
|
14752
|
+
readonly command: Schema.Union<readonly [Schema.Literals<readonly ["session.list", "session.new", "session.interrupt", "session.background", "session.compact", "session.page.up", "session.page.down", "session.line.up", "session.line.down", "session.half.page.up", "session.half.page.down", "session.first", "session.last", "prompt.clear", "prompt.submit", "agent.cycle"]>, Schema.String]>;
|
|
14753
14753
|
}>;
|
|
14754
14754
|
}> & {
|
|
14755
14755
|
type: "tui.command.execute";
|
|
14756
14756
|
durability: "ephemeral";
|
|
14757
14757
|
durable: undefined;
|
|
14758
14758
|
data: Schema.Struct<{
|
|
14759
|
-
readonly command: Schema.Union<readonly [Schema.Literals<readonly ["session.list", "session.new", "session.
|
|
14759
|
+
readonly command: Schema.Union<readonly [Schema.Literals<readonly ["session.list", "session.new", "session.interrupt", "session.background", "session.compact", "session.page.up", "session.page.down", "session.line.up", "session.line.down", "session.half.page.up", "session.half.page.down", "session.first", "session.last", "prompt.clear", "prompt.submit", "agent.cycle"]>, Schema.String]>;
|
|
14760
14760
|
}>;
|
|
14761
14761
|
}, Schema.Struct<{
|
|
14762
14762
|
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
@@ -3,6 +3,7 @@ import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/http-api";
|
|
|
3
3
|
import { ForbiddenError, InvalidRequestError, PtyNotFoundError, ServiceUnavailableError } from "../errors.js";
|
|
4
4
|
import { PTY_CONNECT_TICKET_QUERY, PTY_CONNECT_TOKEN_HEADER, PTY_CONNECT_TOKEN_HEADER_VALUE } from "./pty.js";
|
|
5
5
|
export { PTY_CONNECT_TICKET_QUERY, PTY_CONNECT_TOKEN_HEADER, PTY_CONNECT_TOKEN_HEADER_VALUE };
|
|
6
|
+
export declare const PERSISTENT_PTY_CONNECT_PATH = "/api/experimental/persistent-pty/:ptyID/connect";
|
|
6
7
|
export declare function hasPersistentPtyConnectTicketURL(url: URL): boolean;
|
|
7
8
|
export declare const PersistentPtyGroup: HttpApiGroup.HttpApiGroup<"server.experimental", HttpApiEndpoint.HttpApiEndpoint<"persistentPty.read", "GET", "/api/experimental/session/:sessionID/terminal/read", Schema.toCodecStringTree<Schema.Struct<{
|
|
8
9
|
sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
@@ -7,9 +7,10 @@ import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/ht
|
|
|
7
7
|
import { ForbiddenError, InvalidRequestError, PtyNotFoundError, ServiceUnavailableError } from "../errors.js";
|
|
8
8
|
import { PTY_CONNECT_TICKET_QUERY, PTY_CONNECT_TOKEN_HEADER, PTY_CONNECT_TOKEN_HEADER_VALUE } from "./pty.js";
|
|
9
9
|
export { PTY_CONNECT_TICKET_QUERY, PTY_CONNECT_TOKEN_HEADER, PTY_CONNECT_TOKEN_HEADER_VALUE };
|
|
10
|
-
const
|
|
10
|
+
export const PERSISTENT_PTY_CONNECT_PATH = "/api/experimental/persistent-pty/:ptyID/connect";
|
|
11
|
+
const PERSISTENT_PTY_CONNECT_URL = /^\/api\/experimental\/persistent-pty\/[^/]+\/connect$/;
|
|
11
12
|
export function hasPersistentPtyConnectTicketURL(url) {
|
|
12
|
-
return
|
|
13
|
+
return PERSISTENT_PTY_CONNECT_URL.test(url.pathname) && !!url.searchParams.get(PTY_CONNECT_TICKET_QUERY);
|
|
13
14
|
}
|
|
14
15
|
const errors = [InvalidRequestError, ServiceUnavailableError];
|
|
15
16
|
const terminalErrors = [PtyNotFoundError, ServiceUnavailableError];
|
|
@@ -71,7 +72,7 @@ export const PersistentPtyGroup = HttpApiGroup.make("server.experimental")
|
|
|
71
72
|
success: Schema.Struct({ data: PtyTicket.ConnectToken }),
|
|
72
73
|
error: [ForbiddenError, PtyNotFoundError, ServiceUnavailableError],
|
|
73
74
|
}))
|
|
74
|
-
.add(HttpApiEndpoint.get("persistentPty.connect",
|
|
75
|
+
.add(HttpApiEndpoint.get("persistentPty.connect", PERSISTENT_PTY_CONNECT_PATH, {
|
|
75
76
|
params: { ptyID: Pty.ID },
|
|
76
77
|
success: Schema.Boolean,
|
|
77
78
|
error: [ForbiddenError, PtyNotFoundError, ServiceUnavailableError],
|
package/dist/groups/pty.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { ForbiddenError, LocationNotFoundError, PtyNotFoundError } from "../erro
|
|
|
4
4
|
export declare const PTY_CONNECT_TICKET_QUERY = "ticket";
|
|
5
5
|
export declare const PTY_CONNECT_TOKEN_HEADER = "x-opencode-ticket";
|
|
6
6
|
export declare const PTY_CONNECT_TOKEN_HEADER_VALUE = "1";
|
|
7
|
+
export declare const PTY_CONNECT_PATH = "/api/pty/:ptyID/connect";
|
|
7
8
|
export declare function hasPtyConnectTicketURL(url: URL): boolean;
|
|
8
9
|
export declare const makePtyGroup: <LocationId extends HttpApiMiddleware.AnyId, LocationService>(locationMiddleware: Context.Key<LocationId, LocationService>) => HttpApiGroup.HttpApiGroup<"server.pty", HttpApiEndpoint.HttpApiEndpoint<"pty.list", "GET", "/api/pty", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
9
10
|
readonly location: Schema.optional<Schema.Struct<{
|
package/dist/groups/pty.js
CHANGED
|
@@ -8,11 +8,10 @@ import { LocationQuery, locationQueryOpenApi } from "./location.js";
|
|
|
8
8
|
export const PTY_CONNECT_TICKET_QUERY = "ticket";
|
|
9
9
|
export const PTY_CONNECT_TOKEN_HEADER = "x-opencode-ticket";
|
|
10
10
|
export const PTY_CONNECT_TOKEN_HEADER_VALUE = "1";
|
|
11
|
-
const PTY_CONNECT_PATH =
|
|
12
|
-
|
|
13
|
-
// is then responsible for consuming and validating the ticket.
|
|
11
|
+
export const PTY_CONNECT_PATH = "/api/pty/:ptyID/connect";
|
|
12
|
+
const PTY_CONNECT_URL = /^\/api\/pty\/[^/]+\/connect$/;
|
|
14
13
|
export function hasPtyConnectTicketURL(url) {
|
|
15
|
-
return
|
|
14
|
+
return PTY_CONNECT_URL.test(url.pathname) && !!url.searchParams.get(PTY_CONNECT_TICKET_QUERY);
|
|
16
15
|
}
|
|
17
16
|
export const makePtyGroup = (locationMiddleware) => HttpApiGroup.make("server.pty")
|
|
18
17
|
.add(HttpApiEndpoint.get("pty.list", "/api/pty", {
|
|
@@ -89,7 +88,7 @@ export const makePtyGroup = (locationMiddleware) => HttpApiGroup.make("server.pt
|
|
|
89
88
|
.middleware(locationMiddleware)
|
|
90
89
|
.add(
|
|
91
90
|
// Query fields are decoded in the raw handler before upgrade work.
|
|
92
|
-
HttpApiEndpoint.get("pty.connect",
|
|
91
|
+
HttpApiEndpoint.get("pty.connect", PTY_CONNECT_PATH, {
|
|
93
92
|
params: { ptyID: Pty.ID },
|
|
94
93
|
success: Schema.Boolean,
|
|
95
94
|
error: [ForbiddenError, PtyNotFoundError, LocationNotFoundError],
|
package/dist/groups/server.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare const PairingSession: Schema.Struct<{
|
|
|
22
22
|
readonly token: Schema.String;
|
|
23
23
|
}>;
|
|
24
24
|
export type PairingSession = typeof PairingSession.Type;
|
|
25
|
+
export declare const PAIRING_CONNECT_PATH = "/auth/connect/:code";
|
|
25
26
|
export declare function isPairingConnectURL(url: URL): boolean;
|
|
26
27
|
export declare const ServerGroup: HttpApiGroup.HttpApiGroup<"server.server", HttpApiEndpoint.HttpApiEndpoint<"server.info", "GET", "/api/info", never, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
27
28
|
readonly version: Schema.String;
|
package/dist/groups/server.js
CHANGED
|
@@ -21,10 +21,10 @@ export const PairingCode = Schema.Struct({
|
|
|
21
21
|
export const PairingSession = Schema.Struct({
|
|
22
22
|
token: Schema.String,
|
|
23
23
|
}).annotate({ identifier: "PairingSession" });
|
|
24
|
-
const PAIRING_CONNECT_PATH =
|
|
25
|
-
|
|
24
|
+
export const PAIRING_CONNECT_PATH = "/auth/connect/:code";
|
|
25
|
+
const PAIRING_CONNECT_URL = /^\/auth\/connect\/[^/]+$/;
|
|
26
26
|
export function isPairingConnectURL(url) {
|
|
27
|
-
return
|
|
27
|
+
return PAIRING_CONNECT_URL.test(url.pathname);
|
|
28
28
|
}
|
|
29
29
|
export const ServerGroup = HttpApiGroup.make("server.server")
|
|
30
30
|
.add(HttpApiEndpoint.get("server.info", "/api/info", {
|
|
@@ -41,7 +41,7 @@ export const ServerGroup = HttpApiGroup.make("server.server")
|
|
|
41
41
|
summary: "Create pairing code",
|
|
42
42
|
description: "Create a short-lived, single-use code for a /auth/connect/:code pairing link.",
|
|
43
43
|
})))
|
|
44
|
-
.add(HttpApiEndpoint.get("server.connect",
|
|
44
|
+
.add(HttpApiEndpoint.get("server.connect", PAIRING_CONNECT_PATH, {
|
|
45
45
|
params: { code: Schema.String },
|
|
46
46
|
success: PairingSession,
|
|
47
47
|
error: UnauthorizedError,
|
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.
|
|
4
|
+
"version": "2.0.30",
|
|
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.
|
|
35
|
+
"@opencode/schema": "2.0.30",
|
|
36
36
|
"effect": "4.0.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|