@opencode-ai/protocol 0.0.0-dev-18199 → 0.0.0-dev-18203
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +2 -1
- package/dist/api.js +2 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +3 -2
- package/dist/groups/event.d.ts +359 -22
- package/dist/groups/persistent-pty.d.ts +216 -0
- package/dist/groups/persistent-pty.js +76 -0
- package/dist/simulation.d.ts +2 -2
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { HealthGroup } from "./groups/health.js";
|
|
|
19
19
|
import { ServerGroup } from "./groups/server.js";
|
|
20
20
|
import { DebugGroup } from "./groups/debug.js";
|
|
21
21
|
import { PtyGroup } from "./groups/pty.js";
|
|
22
|
+
import { PersistentPtyGroup } from "./groups/persistent-pty.js";
|
|
22
23
|
import { ShellGroup } from "./groups/shell.js";
|
|
23
24
|
import { ReferenceGroup } from "./groups/reference.js";
|
|
24
25
|
import { Authorization } from "./middleware/authorization.js";
|
|
@@ -37,7 +38,7 @@ type LocationGroups<LocationId extends HttpApiMiddleware.AnyId> = HttpApiGroup.A
|
|
|
37
38
|
type SessionGroups<SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService> = ReturnType<typeof makeSessionGroup<SessionLocationId, SessionLocationService>> | typeof MessageGroup;
|
|
38
39
|
type FormGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService> = ReturnType<typeof makeFormGroup<LocationId, LocationService, FormLocationId, FormLocationService>>;
|
|
39
40
|
type MixedMiddlewareGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService> = ReturnType<typeof makePermissionGroup<LocationId, LocationService, SessionLocationId, SessionLocationService>>;
|
|
40
|
-
type ApiGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = typeof HealthGroup | typeof ServerGroup | typeof DebugGroup | typeof MigrationGroup | typeof WorktreeGroup | typeof WorkspaceGroup | typeof GenerateGroup | LocationGroups<LocationId> | FormGroups<LocationId, LocationService, FormLocationId, FormLocationService> | SessionGroups<SessionLocationId, SessionLocationService> | MixedMiddlewareGroups<LocationId, LocationService, SessionLocationId, SessionLocationService> | Event;
|
|
41
|
+
type ApiGroups<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = typeof HealthGroup | typeof ServerGroup | typeof DebugGroup | typeof MigrationGroup | typeof WorktreeGroup | typeof WorkspaceGroup | typeof GenerateGroup | typeof PersistentPtyGroup | LocationGroups<LocationId> | FormGroups<LocationId, LocationService, FormLocationId, FormLocationService> | SessionGroups<SessionLocationId, SessionLocationService> | MixedMiddlewareGroups<LocationId, LocationService, SessionLocationId, SessionLocationService> | Event;
|
|
41
42
|
type EventGroupFor<Definitions extends ReadonlyArray<Definition>> = ReturnType<typeof makeEventGroup<Definitions>>;
|
|
42
43
|
export type Api<LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService, Event extends HttpApiGroup.Constraint> = HttpApi.HttpApi<"server", HttpApiGroup.AddMiddleware<HttpApiGroup.AddMiddleware<ApiGroups<LocationId, LocationService, FormLocationId, FormLocationService, SessionLocationId, SessionLocationService, Event>, Authorization>, SchemaErrorMiddleware>>;
|
|
43
44
|
export declare const makeApi: <const Definitions extends ReadonlyArray<Definition>, LocationId extends HttpApiMiddleware.AnyId, LocationService, FormLocationId extends HttpApiMiddleware.AnyId, FormLocationService, SessionLocationId extends HttpApiMiddleware.AnyId, SessionLocationService>(options: {
|
package/dist/api.js
CHANGED
|
@@ -18,6 +18,7 @@ import { HealthGroup } from "./groups/health.js";
|
|
|
18
18
|
import { ServerGroup } from "./groups/server.js";
|
|
19
19
|
import { DebugGroup } from "./groups/debug.js";
|
|
20
20
|
import { PtyGroup } from "./groups/pty.js";
|
|
21
|
+
import { PersistentPtyGroup } from "./groups/persistent-pty.js";
|
|
21
22
|
import { ShellGroup } from "./groups/shell.js";
|
|
22
23
|
import { ReferenceGroup } from "./groups/reference.js";
|
|
23
24
|
import { Authorization } from "./middleware/authorization.js";
|
|
@@ -55,6 +56,7 @@ const makeApiFromGroup = (eventGroup, locationMiddleware, formLocationMiddleware
|
|
|
55
56
|
.add(SkillGroup.middleware(locationMiddleware))
|
|
56
57
|
.add(eventGroup)
|
|
57
58
|
.add(PtyGroup.middleware(locationMiddleware))
|
|
59
|
+
.add(PersistentPtyGroup)
|
|
58
60
|
.add(ShellGroup.middleware(locationMiddleware))
|
|
59
61
|
.add(ReferenceGroup.middleware(locationMiddleware))
|
|
60
62
|
.add(WorktreeGroup)
|
package/dist/client.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export declare const groupNames: {
|
|
|
48
48
|
readonly "server.skill": "skill";
|
|
49
49
|
readonly "server.event": "event";
|
|
50
50
|
readonly "server.pty": "pty";
|
|
51
|
+
readonly "server.experimental": "experimental";
|
|
51
52
|
readonly "server.shell": "shell";
|
|
52
53
|
readonly "server.mcp": "mcp";
|
|
53
54
|
readonly "server.reference": "reference";
|
package/dist/client.js
CHANGED
|
@@ -35,6 +35,7 @@ export const groupNames = {
|
|
|
35
35
|
"server.skill": "skill",
|
|
36
36
|
"server.event": "event",
|
|
37
37
|
"server.pty": "pty",
|
|
38
|
+
"server.experimental": "experimental",
|
|
38
39
|
"server.shell": "shell",
|
|
39
40
|
"server.mcp": "mcp",
|
|
40
41
|
"server.reference": "reference",
|
|
@@ -44,5 +45,5 @@ export const groupNames = {
|
|
|
44
45
|
"server.vcs": "vcs",
|
|
45
46
|
"server.config": "config",
|
|
46
47
|
};
|
|
47
|
-
export const promiseOmitEndpoints = new Set(["pty.connect"]);
|
|
48
|
-
export const effectOmitEndpoints = new Set(["fs.read", "pty.connect"]);
|
|
48
|
+
export const promiseOmitEndpoints = new Set(["pty.connect", "persistentPty.connect"]);
|
|
49
|
+
export const effectOmitEndpoints = new Set(["fs.read", "pty.connect", "persistentPty.connect"]);
|
package/dist/groups/event.d.ts
CHANGED
|
@@ -4499,6 +4499,150 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
|
|
|
4499
4499
|
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
4500
4500
|
};
|
|
4501
4501
|
}>;
|
|
4502
|
+
}, Schema.Struct<{
|
|
4503
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
4504
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
4505
|
+
};
|
|
4506
|
+
readonly created: Schema.Finite;
|
|
4507
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
4508
|
+
readonly type: Schema.Literal<"persistent-pty.added">;
|
|
4509
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
4510
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
4511
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
4512
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4513
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4514
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
4515
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4516
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4517
|
+
}>, never, never>;
|
|
4518
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
4519
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
4520
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
4521
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4522
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4523
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
4524
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4525
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4526
|
+
}>, never, never>;
|
|
4527
|
+
}>>, never, never>;
|
|
4528
|
+
readonly data: Schema.Struct<{
|
|
4529
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
4530
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4531
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
4532
|
+
};
|
|
4533
|
+
readonly terminal: Schema.Struct<{
|
|
4534
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
4535
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4536
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
4537
|
+
};
|
|
4538
|
+
readonly foregroundProcess: Schema.NullOr<Schema.String>;
|
|
4539
|
+
readonly size: Schema.Struct<{
|
|
4540
|
+
readonly cols: Schema.Int;
|
|
4541
|
+
readonly rows: Schema.Int;
|
|
4542
|
+
}>;
|
|
4543
|
+
readonly output: Schema.Struct<{
|
|
4544
|
+
readonly head: Schema.Int;
|
|
4545
|
+
readonly tail: Schema.Int;
|
|
4546
|
+
}>;
|
|
4547
|
+
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
4548
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
4549
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
4550
|
+
};
|
|
4551
|
+
readonly title: Schema.String;
|
|
4552
|
+
readonly command: Schema.String;
|
|
4553
|
+
readonly args: Schema.$Array<Schema.String>;
|
|
4554
|
+
readonly cwd: Schema.String;
|
|
4555
|
+
readonly status: Schema.Literals<readonly ["running", "exited"]>;
|
|
4556
|
+
readonly pid: Schema.Int;
|
|
4557
|
+
readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
4558
|
+
}>;
|
|
4559
|
+
}>;
|
|
4560
|
+
}> & {
|
|
4561
|
+
type: "persistent-pty.added";
|
|
4562
|
+
durability: "ephemeral";
|
|
4563
|
+
durable: undefined;
|
|
4564
|
+
data: Schema.Struct<{
|
|
4565
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
4566
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4567
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
4568
|
+
};
|
|
4569
|
+
readonly terminal: Schema.Struct<{
|
|
4570
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
4571
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4572
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
4573
|
+
};
|
|
4574
|
+
readonly foregroundProcess: Schema.NullOr<Schema.String>;
|
|
4575
|
+
readonly size: Schema.Struct<{
|
|
4576
|
+
readonly cols: Schema.Int;
|
|
4577
|
+
readonly rows: Schema.Int;
|
|
4578
|
+
}>;
|
|
4579
|
+
readonly output: Schema.Struct<{
|
|
4580
|
+
readonly head: Schema.Int;
|
|
4581
|
+
readonly tail: Schema.Int;
|
|
4582
|
+
}>;
|
|
4583
|
+
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
4584
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
4585
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
4586
|
+
};
|
|
4587
|
+
readonly title: Schema.String;
|
|
4588
|
+
readonly command: Schema.String;
|
|
4589
|
+
readonly args: Schema.$Array<Schema.String>;
|
|
4590
|
+
readonly cwd: Schema.String;
|
|
4591
|
+
readonly status: Schema.Literals<readonly ["running", "exited"]>;
|
|
4592
|
+
readonly pid: Schema.Int;
|
|
4593
|
+
readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
4594
|
+
}>;
|
|
4595
|
+
}>;
|
|
4596
|
+
}, Schema.Struct<{
|
|
4597
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
4598
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
4599
|
+
};
|
|
4600
|
+
readonly created: Schema.Finite;
|
|
4601
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
4602
|
+
readonly type: Schema.Literal<"persistent-pty.removed">;
|
|
4603
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
4604
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
4605
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
4606
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4607
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4608
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
4609
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4610
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4611
|
+
}>, never, never>;
|
|
4612
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
4613
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
4614
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
4615
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4616
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4617
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
4618
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4619
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4620
|
+
}>, never, never>;
|
|
4621
|
+
}>>, never, never>;
|
|
4622
|
+
readonly data: Schema.Struct<{
|
|
4623
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
4624
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4625
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
4626
|
+
};
|
|
4627
|
+
readonly ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
4628
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
4629
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
4630
|
+
};
|
|
4631
|
+
}>;
|
|
4632
|
+
}> & {
|
|
4633
|
+
type: "persistent-pty.removed";
|
|
4634
|
+
durability: "ephemeral";
|
|
4635
|
+
durable: undefined;
|
|
4636
|
+
data: Schema.Struct<{
|
|
4637
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
4638
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4639
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
4640
|
+
};
|
|
4641
|
+
readonly ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
4642
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
4643
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
4644
|
+
};
|
|
4645
|
+
}>;
|
|
4502
4646
|
}, Schema.Struct<{
|
|
4503
4647
|
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
4504
4648
|
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
@@ -7315,21 +7459,18 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
|
|
|
7315
7459
|
} | {
|
|
7316
7460
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7317
7461
|
readonly data: {
|
|
7318
|
-
readonly
|
|
7462
|
+
readonly info: {
|
|
7463
|
+
readonly id: string & import("effect/Brand").Brand<"PtyID">;
|
|
7464
|
+
readonly command: string;
|
|
7465
|
+
readonly title: string;
|
|
7466
|
+
readonly status: "running" | "exited";
|
|
7467
|
+
readonly pid: number;
|
|
7468
|
+
readonly cwd: string;
|
|
7469
|
+
readonly args: readonly string[];
|
|
7470
|
+
readonly exitCode?: number | undefined;
|
|
7471
|
+
};
|
|
7319
7472
|
};
|
|
7320
|
-
readonly type: "
|
|
7321
|
-
readonly created: number;
|
|
7322
|
-
readonly location?: {
|
|
7323
|
-
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
7324
|
-
readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
|
|
7325
|
-
} | undefined;
|
|
7326
|
-
readonly metadata?: {
|
|
7327
|
-
readonly [x: string]: unknown;
|
|
7328
|
-
} | undefined;
|
|
7329
|
-
} | {
|
|
7330
|
-
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7331
|
-
readonly data: {};
|
|
7332
|
-
readonly type: "plugin.updated";
|
|
7473
|
+
readonly type: "pty.created";
|
|
7333
7474
|
readonly created: number;
|
|
7334
7475
|
readonly location?: {
|
|
7335
7476
|
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
@@ -7352,7 +7493,7 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
|
|
|
7352
7493
|
readonly exitCode?: number | undefined;
|
|
7353
7494
|
};
|
|
7354
7495
|
};
|
|
7355
|
-
readonly type: "pty.
|
|
7496
|
+
readonly type: "pty.updated";
|
|
7356
7497
|
readonly created: number;
|
|
7357
7498
|
readonly location?: {
|
|
7358
7499
|
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
@@ -7364,18 +7505,58 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
|
|
|
7364
7505
|
} | {
|
|
7365
7506
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7366
7507
|
readonly data: {
|
|
7367
|
-
readonly
|
|
7508
|
+
readonly id: string & import("effect/Brand").Brand<"PtyID">;
|
|
7509
|
+
readonly exitCode: number;
|
|
7510
|
+
};
|
|
7511
|
+
readonly type: "pty.exited";
|
|
7512
|
+
readonly created: number;
|
|
7513
|
+
readonly location?: {
|
|
7514
|
+
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
7515
|
+
readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
|
|
7516
|
+
} | undefined;
|
|
7517
|
+
readonly metadata?: {
|
|
7518
|
+
readonly [x: string]: unknown;
|
|
7519
|
+
} | undefined;
|
|
7520
|
+
} | {
|
|
7521
|
+
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7522
|
+
readonly data: {
|
|
7523
|
+
readonly id: string & import("effect/Brand").Brand<"PtyID">;
|
|
7524
|
+
};
|
|
7525
|
+
readonly type: "pty.deleted";
|
|
7526
|
+
readonly created: number;
|
|
7527
|
+
readonly location?: {
|
|
7528
|
+
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
7529
|
+
readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
|
|
7530
|
+
} | undefined;
|
|
7531
|
+
readonly metadata?: {
|
|
7532
|
+
readonly [x: string]: unknown;
|
|
7533
|
+
} | undefined;
|
|
7534
|
+
} | {
|
|
7535
|
+
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7536
|
+
readonly data: {
|
|
7537
|
+
readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
|
|
7538
|
+
readonly terminal: {
|
|
7368
7539
|
readonly id: string & import("effect/Brand").Brand<"PtyID">;
|
|
7540
|
+
readonly size: {
|
|
7541
|
+
readonly cols: number;
|
|
7542
|
+
readonly rows: number;
|
|
7543
|
+
};
|
|
7544
|
+
readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
|
|
7369
7545
|
readonly command: string;
|
|
7370
7546
|
readonly title: string;
|
|
7371
7547
|
readonly status: "running" | "exited";
|
|
7548
|
+
readonly output: {
|
|
7549
|
+
readonly head: number;
|
|
7550
|
+
readonly tail: number;
|
|
7551
|
+
};
|
|
7372
7552
|
readonly pid: number;
|
|
7373
7553
|
readonly cwd: string;
|
|
7374
7554
|
readonly args: readonly string[];
|
|
7555
|
+
readonly foregroundProcess: string | null;
|
|
7375
7556
|
readonly exitCode?: number | undefined;
|
|
7376
7557
|
};
|
|
7377
7558
|
};
|
|
7378
|
-
readonly type: "pty.
|
|
7559
|
+
readonly type: "persistent-pty.added";
|
|
7379
7560
|
readonly created: number;
|
|
7380
7561
|
readonly location?: {
|
|
7381
7562
|
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
@@ -7387,10 +7568,10 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
|
|
|
7387
7568
|
} | {
|
|
7388
7569
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7389
7570
|
readonly data: {
|
|
7390
|
-
readonly
|
|
7391
|
-
readonly
|
|
7571
|
+
readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
|
|
7572
|
+
readonly ptyID: string & import("effect/Brand").Brand<"PtyID">;
|
|
7392
7573
|
};
|
|
7393
|
-
readonly type: "pty.
|
|
7574
|
+
readonly type: "persistent-pty.removed";
|
|
7394
7575
|
readonly created: number;
|
|
7395
7576
|
readonly location?: {
|
|
7396
7577
|
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
@@ -7402,9 +7583,21 @@ export declare const EventGroup: HttpApiGroup.HttpApiGroup<"server.event", HttpA
|
|
|
7402
7583
|
} | {
|
|
7403
7584
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7404
7585
|
readonly data: {
|
|
7405
|
-
readonly id: string & import("effect/Brand").Brand<"
|
|
7586
|
+
readonly id: string & import("effect/Brand").Brand<"Plugin.ID">;
|
|
7406
7587
|
};
|
|
7407
|
-
readonly type: "
|
|
7588
|
+
readonly type: "plugin.added";
|
|
7589
|
+
readonly created: number;
|
|
7590
|
+
readonly location?: {
|
|
7591
|
+
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
7592
|
+
readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
|
|
7593
|
+
} | undefined;
|
|
7594
|
+
readonly metadata?: {
|
|
7595
|
+
readonly [x: string]: unknown;
|
|
7596
|
+
} | undefined;
|
|
7597
|
+
} | {
|
|
7598
|
+
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7599
|
+
readonly data: {};
|
|
7600
|
+
readonly type: "plugin.updated";
|
|
7408
7601
|
readonly created: number;
|
|
7409
7602
|
readonly location?: {
|
|
7410
7603
|
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
@@ -12024,6 +12217,150 @@ export declare const OpenCodeEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
12024
12217
|
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
12025
12218
|
};
|
|
12026
12219
|
}>;
|
|
12220
|
+
}, Schema.Struct<{
|
|
12221
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
12222
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
12223
|
+
};
|
|
12224
|
+
readonly created: Schema.Finite;
|
|
12225
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
12226
|
+
readonly type: Schema.Literal<"persistent-pty.added">;
|
|
12227
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
12228
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
12229
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
12230
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12231
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12232
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
12233
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12234
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12235
|
+
}>, never, never>;
|
|
12236
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
12237
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
12238
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
12239
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12240
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12241
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
12242
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12243
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12244
|
+
}>, never, never>;
|
|
12245
|
+
}>>, never, never>;
|
|
12246
|
+
readonly data: Schema.Struct<{
|
|
12247
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
12248
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
12249
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
12250
|
+
};
|
|
12251
|
+
readonly terminal: Schema.Struct<{
|
|
12252
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
12253
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
12254
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
12255
|
+
};
|
|
12256
|
+
readonly foregroundProcess: Schema.NullOr<Schema.String>;
|
|
12257
|
+
readonly size: Schema.Struct<{
|
|
12258
|
+
readonly cols: Schema.Int;
|
|
12259
|
+
readonly rows: Schema.Int;
|
|
12260
|
+
}>;
|
|
12261
|
+
readonly output: Schema.Struct<{
|
|
12262
|
+
readonly head: Schema.Int;
|
|
12263
|
+
readonly tail: Schema.Int;
|
|
12264
|
+
}>;
|
|
12265
|
+
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
12266
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
12267
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
12268
|
+
};
|
|
12269
|
+
readonly title: Schema.String;
|
|
12270
|
+
readonly command: Schema.String;
|
|
12271
|
+
readonly args: Schema.$Array<Schema.String>;
|
|
12272
|
+
readonly cwd: Schema.String;
|
|
12273
|
+
readonly status: Schema.Literals<readonly ["running", "exited"]>;
|
|
12274
|
+
readonly pid: Schema.Int;
|
|
12275
|
+
readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
12276
|
+
}>;
|
|
12277
|
+
}>;
|
|
12278
|
+
}> & {
|
|
12279
|
+
type: "persistent-pty.added";
|
|
12280
|
+
durability: "ephemeral";
|
|
12281
|
+
durable: undefined;
|
|
12282
|
+
data: Schema.Struct<{
|
|
12283
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
12284
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
12285
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
12286
|
+
};
|
|
12287
|
+
readonly terminal: Schema.Struct<{
|
|
12288
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
12289
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
12290
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
12291
|
+
};
|
|
12292
|
+
readonly foregroundProcess: Schema.NullOr<Schema.String>;
|
|
12293
|
+
readonly size: Schema.Struct<{
|
|
12294
|
+
readonly cols: Schema.Int;
|
|
12295
|
+
readonly rows: Schema.Int;
|
|
12296
|
+
}>;
|
|
12297
|
+
readonly output: Schema.Struct<{
|
|
12298
|
+
readonly head: Schema.Int;
|
|
12299
|
+
readonly tail: Schema.Int;
|
|
12300
|
+
}>;
|
|
12301
|
+
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
12302
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
12303
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
12304
|
+
};
|
|
12305
|
+
readonly title: Schema.String;
|
|
12306
|
+
readonly command: Schema.String;
|
|
12307
|
+
readonly args: Schema.$Array<Schema.String>;
|
|
12308
|
+
readonly cwd: Schema.String;
|
|
12309
|
+
readonly status: Schema.Literals<readonly ["running", "exited"]>;
|
|
12310
|
+
readonly pid: Schema.Int;
|
|
12311
|
+
readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
12312
|
+
}>;
|
|
12313
|
+
}>;
|
|
12314
|
+
}, Schema.Struct<{
|
|
12315
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
12316
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
12317
|
+
};
|
|
12318
|
+
readonly created: Schema.Finite;
|
|
12319
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
12320
|
+
readonly type: Schema.Literal<"persistent-pty.removed">;
|
|
12321
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
12322
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
12323
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
12324
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12325
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12326
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
12327
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12328
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12329
|
+
}>, never, never>;
|
|
12330
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
12331
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
12332
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
12333
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12334
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12335
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
12336
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12337
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
12338
|
+
}>, never, never>;
|
|
12339
|
+
}>>, never, never>;
|
|
12340
|
+
readonly data: Schema.Struct<{
|
|
12341
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
12342
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
12343
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
12344
|
+
};
|
|
12345
|
+
readonly ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
12346
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
12347
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
12348
|
+
};
|
|
12349
|
+
}>;
|
|
12350
|
+
}> & {
|
|
12351
|
+
type: "persistent-pty.removed";
|
|
12352
|
+
durability: "ephemeral";
|
|
12353
|
+
durable: undefined;
|
|
12354
|
+
data: Schema.Struct<{
|
|
12355
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
12356
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
12357
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
12358
|
+
};
|
|
12359
|
+
readonly ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
12360
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
12361
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
12362
|
+
};
|
|
12363
|
+
}>;
|
|
12027
12364
|
}, Schema.Struct<{
|
|
12028
12365
|
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
12029
12366
|
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "effect/unstable/httpapi";
|
|
3
|
+
import { ForbiddenError, InvalidRequestError, PtyNotFoundError, ServiceUnavailableError } from "../errors.js";
|
|
4
|
+
import { PTY_CONNECT_TICKET_QUERY, PTY_CONNECT_TOKEN_HEADER, PTY_CONNECT_TOKEN_HEADER_VALUE } from "./pty.js";
|
|
5
|
+
export { PTY_CONNECT_TICKET_QUERY, PTY_CONNECT_TOKEN_HEADER, PTY_CONNECT_TOKEN_HEADER_VALUE };
|
|
6
|
+
export declare function hasPersistentPtyConnectTicketURL(url: URL): boolean;
|
|
7
|
+
export declare const PersistentPtyGroup: HttpApiGroup.HttpApiGroup<"server.experimental", HttpApiEndpoint.HttpApiEndpoint<"persistentPty.list", "GET", "/api/experimental/session/:sessionID/terminal", Schema.toCodecStringTree<Schema.Struct<{
|
|
8
|
+
sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
9
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
10
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
11
|
+
};
|
|
12
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
13
|
+
readonly data: Schema.$Array<Schema.Struct<{
|
|
14
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
15
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
16
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
17
|
+
};
|
|
18
|
+
readonly foregroundProcess: Schema.NullOr<Schema.String>;
|
|
19
|
+
readonly size: Schema.Struct<{
|
|
20
|
+
readonly cols: Schema.Int;
|
|
21
|
+
readonly rows: Schema.Int;
|
|
22
|
+
}>;
|
|
23
|
+
readonly output: Schema.Struct<{
|
|
24
|
+
readonly head: Schema.Int;
|
|
25
|
+
readonly tail: Schema.Int;
|
|
26
|
+
}>;
|
|
27
|
+
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
28
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
29
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
30
|
+
};
|
|
31
|
+
readonly title: Schema.String;
|
|
32
|
+
readonly command: Schema.String;
|
|
33
|
+
readonly args: Schema.$Array<Schema.String>;
|
|
34
|
+
readonly cwd: Schema.String;
|
|
35
|
+
readonly status: Schema.Literals<readonly ["running", "exited"]>;
|
|
36
|
+
readonly pid: Schema.Int;
|
|
37
|
+
readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
38
|
+
}>>;
|
|
39
|
+
}>>, Schema.toCodecJson<typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"persistentPty.create", "POST", "/api/experimental/session/:sessionID/terminal", Schema.toCodecStringTree<Schema.Struct<{
|
|
40
|
+
sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
41
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
42
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
43
|
+
};
|
|
44
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
45
|
+
readonly command: Schema.String;
|
|
46
|
+
readonly args: Schema.$Array<Schema.String>;
|
|
47
|
+
readonly cwd: Schema.String;
|
|
48
|
+
readonly title: Schema.String;
|
|
49
|
+
readonly env: Schema.$Record<Schema.String, Schema.String>;
|
|
50
|
+
readonly size: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
51
|
+
readonly cols: Schema.Int;
|
|
52
|
+
readonly rows: Schema.Int;
|
|
53
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
54
|
+
readonly cols: Schema.Int;
|
|
55
|
+
readonly rows: Schema.Int;
|
|
56
|
+
}>>, never, never>;
|
|
57
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
58
|
+
readonly data: Schema.Struct<{
|
|
59
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
60
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
61
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
62
|
+
};
|
|
63
|
+
readonly foregroundProcess: Schema.NullOr<Schema.String>;
|
|
64
|
+
readonly size: Schema.Struct<{
|
|
65
|
+
readonly cols: Schema.Int;
|
|
66
|
+
readonly rows: Schema.Int;
|
|
67
|
+
}>;
|
|
68
|
+
readonly output: Schema.Struct<{
|
|
69
|
+
readonly head: Schema.Int;
|
|
70
|
+
readonly tail: Schema.Int;
|
|
71
|
+
}>;
|
|
72
|
+
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
73
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
74
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
75
|
+
};
|
|
76
|
+
readonly title: Schema.String;
|
|
77
|
+
readonly command: Schema.String;
|
|
78
|
+
readonly args: Schema.$Array<Schema.String>;
|
|
79
|
+
readonly cwd: Schema.String;
|
|
80
|
+
readonly status: Schema.Literals<readonly ["running", "exited"]>;
|
|
81
|
+
readonly pid: Schema.Int;
|
|
82
|
+
readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
83
|
+
}>;
|
|
84
|
+
}>>, Schema.toCodecJson<typeof InvalidRequestError | typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"persistentPty.shutdown", "POST", "/api/experimental/persistent-pty/shutdown", never, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ServiceUnavailableError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"persistentPty.get", "GET", "/api/experimental/persistent-pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
|
|
85
|
+
ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
86
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
87
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
88
|
+
};
|
|
89
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
90
|
+
readonly data: Schema.Struct<{
|
|
91
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
92
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
93
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
94
|
+
};
|
|
95
|
+
readonly foregroundProcess: Schema.NullOr<Schema.String>;
|
|
96
|
+
readonly size: Schema.Struct<{
|
|
97
|
+
readonly cols: Schema.Int;
|
|
98
|
+
readonly rows: Schema.Int;
|
|
99
|
+
}>;
|
|
100
|
+
readonly output: Schema.Struct<{
|
|
101
|
+
readonly head: Schema.Int;
|
|
102
|
+
readonly tail: Schema.Int;
|
|
103
|
+
}>;
|
|
104
|
+
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
105
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
106
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
107
|
+
};
|
|
108
|
+
readonly title: Schema.String;
|
|
109
|
+
readonly command: Schema.String;
|
|
110
|
+
readonly args: Schema.$Array<Schema.String>;
|
|
111
|
+
readonly cwd: Schema.String;
|
|
112
|
+
readonly status: Schema.Literals<readonly ["running", "exited"]>;
|
|
113
|
+
readonly pid: Schema.Int;
|
|
114
|
+
readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
115
|
+
}>;
|
|
116
|
+
}>>, Schema.toCodecJson<typeof ServiceUnavailableError | typeof PtyNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"persistentPty.update", "PUT", "/api/experimental/persistent-pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
|
|
117
|
+
ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
118
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
119
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
120
|
+
};
|
|
121
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
122
|
+
readonly attachmentID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
123
|
+
readonly size: Schema.Struct<{
|
|
124
|
+
readonly cols: Schema.Int;
|
|
125
|
+
readonly rows: Schema.Int;
|
|
126
|
+
}>;
|
|
127
|
+
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
128
|
+
readonly data: Schema.Struct<{
|
|
129
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
130
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
131
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
132
|
+
};
|
|
133
|
+
readonly foregroundProcess: Schema.NullOr<Schema.String>;
|
|
134
|
+
readonly size: Schema.Struct<{
|
|
135
|
+
readonly cols: Schema.Int;
|
|
136
|
+
readonly rows: Schema.Int;
|
|
137
|
+
}>;
|
|
138
|
+
readonly output: Schema.Struct<{
|
|
139
|
+
readonly head: Schema.Int;
|
|
140
|
+
readonly tail: Schema.Int;
|
|
141
|
+
}>;
|
|
142
|
+
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
143
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
144
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
145
|
+
};
|
|
146
|
+
readonly title: Schema.String;
|
|
147
|
+
readonly command: Schema.String;
|
|
148
|
+
readonly args: Schema.$Array<Schema.String>;
|
|
149
|
+
readonly cwd: Schema.String;
|
|
150
|
+
readonly status: Schema.Literals<readonly ["running", "exited"]>;
|
|
151
|
+
readonly pid: Schema.Int;
|
|
152
|
+
readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
153
|
+
}>;
|
|
154
|
+
}>>, Schema.toCodecJson<typeof ServiceUnavailableError | typeof PtyNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"persistentPty.snapshot", "GET", "/api/experimental/persistent-pty/:ptyID/snapshot", Schema.toCodecStringTree<Schema.Struct<{
|
|
155
|
+
ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
156
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
157
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
158
|
+
};
|
|
159
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Struct<{
|
|
160
|
+
readonly data: Schema.Struct<{
|
|
161
|
+
readonly info: Schema.Struct<{
|
|
162
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
163
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
164
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
165
|
+
};
|
|
166
|
+
readonly foregroundProcess: Schema.NullOr<Schema.String>;
|
|
167
|
+
readonly size: Schema.Struct<{
|
|
168
|
+
readonly cols: Schema.Int;
|
|
169
|
+
readonly rows: Schema.Int;
|
|
170
|
+
}>;
|
|
171
|
+
readonly output: Schema.Struct<{
|
|
172
|
+
readonly head: Schema.Int;
|
|
173
|
+
readonly tail: Schema.Int;
|
|
174
|
+
}>;
|
|
175
|
+
readonly id: Schema.brand<Schema.String, "PtyID"> & {
|
|
176
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
177
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
178
|
+
};
|
|
179
|
+
readonly title: Schema.String;
|
|
180
|
+
readonly command: Schema.String;
|
|
181
|
+
readonly args: Schema.$Array<Schema.String>;
|
|
182
|
+
readonly cwd: Schema.String;
|
|
183
|
+
readonly status: Schema.Literals<readonly ["running", "exited"]>;
|
|
184
|
+
readonly pid: Schema.Int;
|
|
185
|
+
readonly exitCode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
186
|
+
}>;
|
|
187
|
+
readonly text: Schema.String;
|
|
188
|
+
readonly checkpoint: Schema.Uint8Array;
|
|
189
|
+
readonly cursor: Schema.Struct<{
|
|
190
|
+
readonly x: Schema.Int;
|
|
191
|
+
readonly y: Schema.Int;
|
|
192
|
+
}>;
|
|
193
|
+
}>;
|
|
194
|
+
}>>, Schema.toCodecJson<typeof ServiceUnavailableError | typeof PtyNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"persistentPty.remove", "DELETE", "/api/experimental/persistent-pty/:ptyID", Schema.toCodecStringTree<Schema.Struct<{
|
|
195
|
+
ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
196
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
197
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
198
|
+
};
|
|
199
|
+
}>>, never, never, never, Schema.toCodecJson<HttpApiSchema.NoContent>, Schema.toCodecJson<typeof ServiceUnavailableError | typeof PtyNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"persistentPty.connectToken", "POST", "/api/experimental/persistent-pty/:ptyID/connect-token", Schema.toCodecStringTree<Schema.Struct<{
|
|
200
|
+
ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
201
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
202
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
203
|
+
};
|
|
204
|
+
}>>, never, never, Schema.toCodecStringTree<Schema.Struct<{
|
|
205
|
+
readonly "x-opencode-ticket": Schema.optional<Schema.String>;
|
|
206
|
+
}>>, Schema.toCodecJson<Schema.Struct<{
|
|
207
|
+
readonly data: Schema.Struct<{
|
|
208
|
+
readonly ticket: Schema.String;
|
|
209
|
+
readonly expires_in: Schema.Int;
|
|
210
|
+
}>;
|
|
211
|
+
}>>, Schema.toCodecJson<typeof ServiceUnavailableError | typeof ForbiddenError | typeof PtyNotFoundError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"persistentPty.connect", "GET", "/api/experimental/persistent-pty/:ptyID/connect", Schema.toCodecStringTree<Schema.Struct<{
|
|
212
|
+
ptyID: Schema.brand<Schema.String, "PtyID"> & {
|
|
213
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
214
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
215
|
+
};
|
|
216
|
+
}>>, never, never, never, Schema.toCodecJson<Schema.Boolean>, Schema.toCodecJson<typeof ServiceUnavailableError | typeof ForbiddenError | typeof PtyNotFoundError>, never, never>, false>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { PersistentPty } from "@opencode-ai/schema/persistent-pty";
|
|
2
|
+
import { Pty } from "@opencode-ai/schema/pty";
|
|
3
|
+
import { PtyTicket } from "@opencode-ai/schema/pty-ticket";
|
|
4
|
+
import { Session } from "@opencode-ai/schema/session";
|
|
5
|
+
import { Schema } from "effect";
|
|
6
|
+
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi";
|
|
7
|
+
import { ForbiddenError, InvalidRequestError, PtyNotFoundError, ServiceUnavailableError } from "../errors.js";
|
|
8
|
+
import { PTY_CONNECT_TICKET_QUERY, PTY_CONNECT_TOKEN_HEADER, PTY_CONNECT_TOKEN_HEADER_VALUE } from "./pty.js";
|
|
9
|
+
export { PTY_CONNECT_TICKET_QUERY, PTY_CONNECT_TOKEN_HEADER, PTY_CONNECT_TOKEN_HEADER_VALUE };
|
|
10
|
+
const CONNECT_PATH = /^\/api\/experimental\/persistent-pty\/[^/]+\/connect$/;
|
|
11
|
+
export function hasPersistentPtyConnectTicketURL(url) {
|
|
12
|
+
return CONNECT_PATH.test(url.pathname) && !!url.searchParams.get(PTY_CONNECT_TICKET_QUERY);
|
|
13
|
+
}
|
|
14
|
+
const errors = [InvalidRequestError, ServiceUnavailableError];
|
|
15
|
+
const terminalErrors = [PtyNotFoundError, ServiceUnavailableError];
|
|
16
|
+
export const PersistentPtyGroup = HttpApiGroup.make("server.experimental")
|
|
17
|
+
.add(HttpApiEndpoint.get("persistentPty.list", "/api/experimental/session/:sessionID/terminal", {
|
|
18
|
+
params: { sessionID: Session.ID },
|
|
19
|
+
success: Schema.Struct({ data: Schema.Array(PersistentPty.Info) }),
|
|
20
|
+
error: errors,
|
|
21
|
+
}))
|
|
22
|
+
.add(HttpApiEndpoint.post("persistentPty.create", "/api/experimental/session/:sessionID/terminal", {
|
|
23
|
+
params: { sessionID: Session.ID },
|
|
24
|
+
payload: PersistentPty.CreateInput,
|
|
25
|
+
success: Schema.Struct({ data: PersistentPty.Info }),
|
|
26
|
+
error: errors,
|
|
27
|
+
}))
|
|
28
|
+
.add(HttpApiEndpoint.post("persistentPty.shutdown", "/api/experimental/persistent-pty/shutdown", {
|
|
29
|
+
success: HttpApiSchema.NoContent,
|
|
30
|
+
error: [ServiceUnavailableError],
|
|
31
|
+
}))
|
|
32
|
+
.add(HttpApiEndpoint.get("persistentPty.get", "/api/experimental/persistent-pty/:ptyID", {
|
|
33
|
+
params: { ptyID: Pty.ID },
|
|
34
|
+
success: Schema.Struct({ data: PersistentPty.Info }),
|
|
35
|
+
error: terminalErrors,
|
|
36
|
+
}))
|
|
37
|
+
.add(HttpApiEndpoint.put("persistentPty.update", "/api/experimental/persistent-pty/:ptyID", {
|
|
38
|
+
params: { ptyID: Pty.ID },
|
|
39
|
+
payload: PersistentPty.UpdateInput,
|
|
40
|
+
success: Schema.Struct({ data: PersistentPty.Info }),
|
|
41
|
+
error: terminalErrors,
|
|
42
|
+
}))
|
|
43
|
+
.add(HttpApiEndpoint.get("persistentPty.snapshot", "/api/experimental/persistent-pty/:ptyID/snapshot", {
|
|
44
|
+
params: { ptyID: Pty.ID },
|
|
45
|
+
success: Schema.Struct({ data: PersistentPty.Snapshot }),
|
|
46
|
+
error: terminalErrors,
|
|
47
|
+
}))
|
|
48
|
+
.add(HttpApiEndpoint.delete("persistentPty.remove", "/api/experimental/persistent-pty/:ptyID", {
|
|
49
|
+
params: { ptyID: Pty.ID },
|
|
50
|
+
success: HttpApiSchema.NoContent,
|
|
51
|
+
error: terminalErrors,
|
|
52
|
+
}))
|
|
53
|
+
.add(HttpApiEndpoint.post("persistentPty.connectToken", "/api/experimental/persistent-pty/:ptyID/connect-token", {
|
|
54
|
+
params: { ptyID: Pty.ID },
|
|
55
|
+
headers: Schema.Struct({ [PTY_CONNECT_TOKEN_HEADER]: Schema.optional(Schema.String) }),
|
|
56
|
+
success: Schema.Struct({ data: PtyTicket.ConnectToken }),
|
|
57
|
+
error: [ForbiddenError, PtyNotFoundError, ServiceUnavailableError],
|
|
58
|
+
}))
|
|
59
|
+
.add(HttpApiEndpoint.get("persistentPty.connect", "/api/experimental/persistent-pty/:ptyID/connect", {
|
|
60
|
+
params: { ptyID: Pty.ID },
|
|
61
|
+
success: Schema.Boolean,
|
|
62
|
+
error: [ForbiddenError, PtyNotFoundError, ServiceUnavailableError],
|
|
63
|
+
}).annotateMerge(OpenApi.annotations({
|
|
64
|
+
identifier: "v2.persistentPty.connect",
|
|
65
|
+
summary: "Connect to a persistent PTY",
|
|
66
|
+
description: "Stream persistent PTY output through the OpenCode server.",
|
|
67
|
+
transform: (operation) => ({
|
|
68
|
+
...operation,
|
|
69
|
+
"x-websocket": true,
|
|
70
|
+
parameters: [
|
|
71
|
+
...(operation.parameters ?? []),
|
|
72
|
+
...["cursor", "role", "attachment_id", "takeover", "input_protocol", PTY_CONNECT_TICKET_QUERY].map((name) => ({ in: "query", name, schema: { type: "string" } })),
|
|
73
|
+
],
|
|
74
|
+
}),
|
|
75
|
+
})))
|
|
76
|
+
.annotateMerge(OpenApi.annotations({ title: "persistentPty", description: "Prototype persistent PTY routes." }));
|
package/dist/simulation.d.ts
CHANGED
|
@@ -470,9 +470,9 @@ export declare namespace Frontend {
|
|
|
470
470
|
readonly id?: string | number | null | undefined;
|
|
471
471
|
} | {
|
|
472
472
|
readonly params: {
|
|
473
|
-
readonly target: number;
|
|
474
473
|
readonly x: number;
|
|
475
474
|
readonly y: number;
|
|
475
|
+
readonly target: number;
|
|
476
476
|
readonly semantic?: {
|
|
477
477
|
readonly id: string;
|
|
478
478
|
readonly element: number;
|
|
@@ -557,9 +557,9 @@ export declare namespace Frontend {
|
|
|
557
557
|
readonly id?: string | number | null | undefined;
|
|
558
558
|
} | {
|
|
559
559
|
readonly params: {
|
|
560
|
-
readonly target: number;
|
|
561
560
|
readonly x: number;
|
|
562
561
|
readonly y: number;
|
|
562
|
+
readonly target: number;
|
|
563
563
|
readonly semantic?: {
|
|
564
564
|
readonly id: string;
|
|
565
565
|
readonly element: number;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@opencode-ai/protocol",
|
|
4
|
-
"version": "0.0.0-dev-
|
|
4
|
+
"version": "0.0.0-dev-18203",
|
|
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-ai/schema": "0.0.0-dev-
|
|
35
|
+
"@opencode-ai/schema": "0.0.0-dev-18203",
|
|
36
36
|
"effect": "4.0.0-rc.111"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|