@opencode-ai/server 0.0.0-beta-18148 → 0.0.0-beta-18219
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 +219 -23
- package/dist/handlers/persistent-pty.d.ts +3 -0
- package/dist/handlers/persistent-pty.js +126 -0
- package/dist/handlers/project.d.ts +1 -1
- package/dist/handlers/project.js +5 -1
- package/dist/handlers/session.js +6 -1
- package/dist/handlers/vcs.js +2 -0
- package/dist/handlers.d.ts +1 -1
- package/dist/handlers.js +2 -1
- package/dist/location.d.ts +2 -2
- package/dist/middleware/authorization.js +3 -2
- package/dist/middleware/form-location.d.ts +2 -2
- package/dist/middleware/session-location.d.ts +2 -2
- package/dist/process.js +2 -1
- package/dist/routes.d.ts +3 -2
- package/dist/routes.js +2 -0
- package/dist/workerd.js +3 -0
- package/package.json +7 -6
package/dist/api.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LocationMiddleware } from "./location";
|
|
2
2
|
import { FormLocationMiddleware } from "./middleware/form-location";
|
|
3
3
|
import { SessionLocationMiddleware } from "./middleware/session-location";
|
|
4
|
-
export declare const Api: import("@opencode-ai/protocol/api").Api<LocationMiddleware, import("effect/unstable/httpapi/HttpApiMiddleware").HttpApiMiddleware<import("@opencode-ai/core/location").Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/
|
|
4
|
+
export declare const Api: import("@opencode-ai/protocol/api").Api<LocationMiddleware, import("effect/unstable/httpapi/HttpApiMiddleware").HttpApiMiddleware<import("@opencode-ai/core/location").Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/permission").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/vcs").Service | import("@opencode-ai/core/location-mutation").Service | import("@opencode-ai/core/tool/read-filesystem").Service | import("@opencode-ai/core/session/instructions").Service | import("@opencode-ai/core/shell").Service | import("@opencode-ai/core/shell/select").Service | import("@opencode-ai/core/instruction-discovery").Service | import("@opencode-ai/core/session/compaction").Service | import("@opencode-ai/core/snapshot").Service | import("@opencode-ai/core/tool-output").Service | import("@opencode-ai/core/session/runner/model").Service | import("@opencode-ai/core/session/model-transport").Service | import("@opencode-ai/core/pty").Service | import("@opencode-ai/core/instructions/builtins").Service | import("@opencode-ai/core/skill/instructions").Service | import("@opencode-ai/core/reference/instructions").Service | import("@opencode-ai/core/session/instruction-entry").Service | import("@opencode-ai/core/session/generate").Service | import("@opencode-ai/core/tool/mcp").Service | import("@opencode-ai/core/session/title").Service | import("@opencode-ai/core/session/runner/index").Service | import("@opencode-ai/core/filesystem/location-watcher").Service, never, never>, FormLocationMiddleware, import("effect/unstable/httpapi/HttpApiMiddleware").HttpApiMiddleware<import("@opencode-ai/core/location").Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/permission").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/vcs").Service | import("@opencode-ai/core/location-mutation").Service | import("@opencode-ai/core/tool/read-filesystem").Service | import("@opencode-ai/core/session/instructions").Service | import("@opencode-ai/core/shell").Service | import("@opencode-ai/core/shell/select").Service | import("@opencode-ai/core/instruction-discovery").Service | import("@opencode-ai/core/session/compaction").Service | import("@opencode-ai/core/snapshot").Service | import("@opencode-ai/core/tool-output").Service | import("@opencode-ai/core/session/runner/model").Service | import("@opencode-ai/core/session/model-transport").Service | import("@opencode-ai/core/pty").Service | import("@opencode-ai/core/instructions/builtins").Service | import("@opencode-ai/core/skill/instructions").Service | import("@opencode-ai/core/reference/instructions").Service | import("@opencode-ai/core/session/instruction-entry").Service | import("@opencode-ai/core/session/generate").Service | import("@opencode-ai/core/tool/mcp").Service | import("@opencode-ai/core/session/title").Service | import("@opencode-ai/core/session/runner/index").Service | import("@opencode-ai/core/filesystem/location-watcher").Service, readonly [typeof import("@opencode-ai/protocol/errors").InvalidRequestError, typeof import("@opencode-ai/protocol/errors").SessionNotFoundError], never>, SessionLocationMiddleware, import("effect/unstable/httpapi/HttpApiMiddleware").HttpApiMiddleware<import("@opencode-ai/core/location").Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/permission").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/vcs").Service | import("@opencode-ai/core/location-mutation").Service | import("@opencode-ai/core/tool/read-filesystem").Service | import("@opencode-ai/core/session/instructions").Service | import("@opencode-ai/core/shell").Service | import("@opencode-ai/core/shell/select").Service | import("@opencode-ai/core/instruction-discovery").Service | import("@opencode-ai/core/session/compaction").Service | import("@opencode-ai/core/snapshot").Service | import("@opencode-ai/core/tool-output").Service | import("@opencode-ai/core/session/runner/model").Service | import("@opencode-ai/core/session/model-transport").Service | import("@opencode-ai/core/pty").Service | import("@opencode-ai/core/instructions/builtins").Service | import("@opencode-ai/core/skill/instructions").Service | import("@opencode-ai/core/reference/instructions").Service | import("@opencode-ai/core/session/instruction-entry").Service | import("@opencode-ai/core/session/generate").Service | import("@opencode-ai/core/tool/mcp").Service | import("@opencode-ai/core/session/title").Service | import("@opencode-ai/core/session/runner/index").Service | import("@opencode-ai/core/filesystem/location-watcher").Service, readonly [typeof import("@opencode-ai/protocol/errors").InvalidRequestError, typeof import("@opencode-ai/protocol/errors").SessionNotFoundError], never>, import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"server.event", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"event.subscribe", "GET", "/api/event", never, never, never, never, import("effect/unstable/httpapi/HttpApiSchema").StreamSse<import("effect/unstable/httpapi/HttpApiSchema").SseEventFromData<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
5
5
|
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
|
|
6
6
|
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
7
7
|
};
|
|
@@ -3923,6 +3923,7 @@ export declare const Api: import("@opencode-ai/protocol/api").Api<LocationMiddle
|
|
|
3923
3923
|
readonly messageID: import("effect/Schema").String;
|
|
3924
3924
|
readonly id: import("effect/Schema").String;
|
|
3925
3925
|
}>]>>, never, never>;
|
|
3926
|
+
readonly message: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
3926
3927
|
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Permission.ID"> & {
|
|
3927
3928
|
create: (id?: string) => string & import("effect/Brand").Brand<"Permission.ID">;
|
|
3928
3929
|
};
|
|
@@ -3949,6 +3950,7 @@ export declare const Api: import("@opencode-ai/protocol/api").Api<LocationMiddle
|
|
|
3949
3950
|
readonly messageID: import("effect/Schema").String;
|
|
3950
3951
|
readonly id: import("effect/Schema").String;
|
|
3951
3952
|
}>]>>, never, never>;
|
|
3953
|
+
readonly message: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
3952
3954
|
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Permission.ID"> & {
|
|
3953
3955
|
create: (id?: string) => string & import("effect/Brand").Brand<"Permission.ID">;
|
|
3954
3956
|
};
|
|
@@ -4469,6 +4471,150 @@ export declare const Api: import("@opencode-ai/protocol/api").Api<LocationMiddle
|
|
|
4469
4471
|
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
4470
4472
|
};
|
|
4471
4473
|
}>;
|
|
4474
|
+
}, import("effect/Schema").Struct<{
|
|
4475
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
|
|
4476
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
4477
|
+
};
|
|
4478
|
+
readonly created: import("effect/Schema").Finite;
|
|
4479
|
+
readonly metadata: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>>, import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>, never, never>;
|
|
4480
|
+
readonly type: import("effect/Schema").Literal<"persistent-pty.added">;
|
|
4481
|
+
readonly location: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Struct<{
|
|
4482
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
4483
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
4484
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4485
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4486
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
4487
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4488
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4489
|
+
}>, never, never>;
|
|
4490
|
+
}>>>, import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
|
|
4491
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
4492
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
4493
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4494
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4495
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
4496
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4497
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4498
|
+
}>, never, never>;
|
|
4499
|
+
}>>, never, never>;
|
|
4500
|
+
readonly data: import("effect/Schema").Struct<{
|
|
4501
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
4502
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4503
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
4504
|
+
};
|
|
4505
|
+
readonly terminal: import("effect/Schema").Struct<{
|
|
4506
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
4507
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4508
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
4509
|
+
};
|
|
4510
|
+
readonly foregroundProcess: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
4511
|
+
readonly size: import("effect/Schema").Struct<{
|
|
4512
|
+
readonly cols: import("effect/Schema").Int;
|
|
4513
|
+
readonly rows: import("effect/Schema").Int;
|
|
4514
|
+
}>;
|
|
4515
|
+
readonly output: import("effect/Schema").Struct<{
|
|
4516
|
+
readonly head: import("effect/Schema").Int;
|
|
4517
|
+
readonly tail: import("effect/Schema").Int;
|
|
4518
|
+
}>;
|
|
4519
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "PtyID"> & {
|
|
4520
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
4521
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
4522
|
+
};
|
|
4523
|
+
readonly title: import("effect/Schema").String;
|
|
4524
|
+
readonly command: import("effect/Schema").String;
|
|
4525
|
+
readonly args: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
4526
|
+
readonly cwd: import("effect/Schema").String;
|
|
4527
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "exited"]>;
|
|
4528
|
+
readonly pid: import("effect/Schema").Int;
|
|
4529
|
+
readonly exitCode: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Int>>, import("effect/Schema").optionalKey<import("effect/Schema").Int>, never, never>;
|
|
4530
|
+
}>;
|
|
4531
|
+
}>;
|
|
4532
|
+
}> & {
|
|
4533
|
+
type: "persistent-pty.added";
|
|
4534
|
+
durability: "ephemeral";
|
|
4535
|
+
durable: undefined;
|
|
4536
|
+
data: import("effect/Schema").Struct<{
|
|
4537
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
4538
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4539
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
4540
|
+
};
|
|
4541
|
+
readonly terminal: import("effect/Schema").Struct<{
|
|
4542
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
4543
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4544
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
4545
|
+
};
|
|
4546
|
+
readonly foregroundProcess: import("effect/Schema").NullOr<import("effect/Schema").String>;
|
|
4547
|
+
readonly size: import("effect/Schema").Struct<{
|
|
4548
|
+
readonly cols: import("effect/Schema").Int;
|
|
4549
|
+
readonly rows: import("effect/Schema").Int;
|
|
4550
|
+
}>;
|
|
4551
|
+
readonly output: import("effect/Schema").Struct<{
|
|
4552
|
+
readonly head: import("effect/Schema").Int;
|
|
4553
|
+
readonly tail: import("effect/Schema").Int;
|
|
4554
|
+
}>;
|
|
4555
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "PtyID"> & {
|
|
4556
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
4557
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
4558
|
+
};
|
|
4559
|
+
readonly title: import("effect/Schema").String;
|
|
4560
|
+
readonly command: import("effect/Schema").String;
|
|
4561
|
+
readonly args: import("effect/Schema").$Array<import("effect/Schema").String>;
|
|
4562
|
+
readonly cwd: import("effect/Schema").String;
|
|
4563
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "exited"]>;
|
|
4564
|
+
readonly pid: import("effect/Schema").Int;
|
|
4565
|
+
readonly exitCode: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Int>>, import("effect/Schema").optionalKey<import("effect/Schema").Int>, never, never>;
|
|
4566
|
+
}>;
|
|
4567
|
+
}>;
|
|
4568
|
+
}, import("effect/Schema").Struct<{
|
|
4569
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
|
|
4570
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
4571
|
+
};
|
|
4572
|
+
readonly created: import("effect/Schema").Finite;
|
|
4573
|
+
readonly metadata: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>>, import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>, never, never>;
|
|
4574
|
+
readonly type: import("effect/Schema").Literal<"persistent-pty.removed">;
|
|
4575
|
+
readonly location: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Struct<{
|
|
4576
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
4577
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
4578
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4579
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4580
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
4581
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4582
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4583
|
+
}>, never, never>;
|
|
4584
|
+
}>>>, import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
|
|
4585
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
4586
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
4587
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4588
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4589
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
4590
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4591
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
4592
|
+
}>, never, never>;
|
|
4593
|
+
}>>, never, never>;
|
|
4594
|
+
readonly data: import("effect/Schema").Struct<{
|
|
4595
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
4596
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4597
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
4598
|
+
};
|
|
4599
|
+
readonly ptyID: import("effect/Schema").brand<import("effect/Schema").String, "PtyID"> & {
|
|
4600
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
4601
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
4602
|
+
};
|
|
4603
|
+
}>;
|
|
4604
|
+
}> & {
|
|
4605
|
+
type: "persistent-pty.removed";
|
|
4606
|
+
durability: "ephemeral";
|
|
4607
|
+
durable: undefined;
|
|
4608
|
+
data: import("effect/Schema").Struct<{
|
|
4609
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
4610
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
4611
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
4612
|
+
};
|
|
4613
|
+
readonly ptyID: import("effect/Schema").brand<import("effect/Schema").String, "PtyID"> & {
|
|
4614
|
+
create: () => string & import("effect/Brand").Brand<"PtyID">;
|
|
4615
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"PtyID">;
|
|
4616
|
+
};
|
|
4617
|
+
}>;
|
|
4472
4618
|
}, import("effect/Schema").Struct<{
|
|
4473
4619
|
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
|
|
4474
4620
|
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
@@ -5785,6 +5931,7 @@ export declare const Api: import("@opencode-ai/protocol/api").Api<LocationMiddle
|
|
|
5785
5931
|
readonly metadata?: {
|
|
5786
5932
|
readonly [x: string]: unknown;
|
|
5787
5933
|
} | undefined;
|
|
5934
|
+
readonly message?: string | undefined;
|
|
5788
5935
|
readonly save?: readonly string[] | undefined;
|
|
5789
5936
|
readonly source?: {
|
|
5790
5937
|
readonly type: "tool";
|
|
@@ -7285,21 +7432,18 @@ export declare const Api: import("@opencode-ai/protocol/api").Api<LocationMiddle
|
|
|
7285
7432
|
} | {
|
|
7286
7433
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7287
7434
|
readonly data: {
|
|
7288
|
-
readonly
|
|
7435
|
+
readonly info: {
|
|
7436
|
+
readonly id: string & import("effect/Brand").Brand<"PtyID">;
|
|
7437
|
+
readonly command: string;
|
|
7438
|
+
readonly title: string;
|
|
7439
|
+
readonly status: "running" | "exited";
|
|
7440
|
+
readonly pid: number;
|
|
7441
|
+
readonly cwd: string;
|
|
7442
|
+
readonly args: readonly string[];
|
|
7443
|
+
readonly exitCode?: number | undefined;
|
|
7444
|
+
};
|
|
7289
7445
|
};
|
|
7290
|
-
readonly type: "
|
|
7291
|
-
readonly created: number;
|
|
7292
|
-
readonly location?: {
|
|
7293
|
-
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
7294
|
-
readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
|
|
7295
|
-
} | undefined;
|
|
7296
|
-
readonly metadata?: {
|
|
7297
|
-
readonly [x: string]: unknown;
|
|
7298
|
-
} | undefined;
|
|
7299
|
-
} | {
|
|
7300
|
-
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7301
|
-
readonly data: {};
|
|
7302
|
-
readonly type: "plugin.updated";
|
|
7446
|
+
readonly type: "pty.created";
|
|
7303
7447
|
readonly created: number;
|
|
7304
7448
|
readonly location?: {
|
|
7305
7449
|
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
@@ -7322,7 +7466,7 @@ export declare const Api: import("@opencode-ai/protocol/api").Api<LocationMiddle
|
|
|
7322
7466
|
readonly exitCode?: number | undefined;
|
|
7323
7467
|
};
|
|
7324
7468
|
};
|
|
7325
|
-
readonly type: "pty.
|
|
7469
|
+
readonly type: "pty.updated";
|
|
7326
7470
|
readonly created: number;
|
|
7327
7471
|
readonly location?: {
|
|
7328
7472
|
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
@@ -7334,18 +7478,58 @@ export declare const Api: import("@opencode-ai/protocol/api").Api<LocationMiddle
|
|
|
7334
7478
|
} | {
|
|
7335
7479
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7336
7480
|
readonly data: {
|
|
7337
|
-
readonly
|
|
7481
|
+
readonly id: string & import("effect/Brand").Brand<"PtyID">;
|
|
7482
|
+
readonly exitCode: number;
|
|
7483
|
+
};
|
|
7484
|
+
readonly type: "pty.exited";
|
|
7485
|
+
readonly created: number;
|
|
7486
|
+
readonly location?: {
|
|
7487
|
+
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
7488
|
+
readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
|
|
7489
|
+
} | undefined;
|
|
7490
|
+
readonly metadata?: {
|
|
7491
|
+
readonly [x: string]: unknown;
|
|
7492
|
+
} | undefined;
|
|
7493
|
+
} | {
|
|
7494
|
+
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7495
|
+
readonly data: {
|
|
7496
|
+
readonly id: string & import("effect/Brand").Brand<"PtyID">;
|
|
7497
|
+
};
|
|
7498
|
+
readonly type: "pty.deleted";
|
|
7499
|
+
readonly created: number;
|
|
7500
|
+
readonly location?: {
|
|
7501
|
+
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
7502
|
+
readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
|
|
7503
|
+
} | undefined;
|
|
7504
|
+
readonly metadata?: {
|
|
7505
|
+
readonly [x: string]: unknown;
|
|
7506
|
+
} | undefined;
|
|
7507
|
+
} | {
|
|
7508
|
+
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7509
|
+
readonly data: {
|
|
7510
|
+
readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
|
|
7511
|
+
readonly terminal: {
|
|
7338
7512
|
readonly id: string & import("effect/Brand").Brand<"PtyID">;
|
|
7513
|
+
readonly size: {
|
|
7514
|
+
readonly cols: number;
|
|
7515
|
+
readonly rows: number;
|
|
7516
|
+
};
|
|
7517
|
+
readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
|
|
7339
7518
|
readonly command: string;
|
|
7340
7519
|
readonly title: string;
|
|
7341
7520
|
readonly status: "running" | "exited";
|
|
7521
|
+
readonly output: {
|
|
7522
|
+
readonly head: number;
|
|
7523
|
+
readonly tail: number;
|
|
7524
|
+
};
|
|
7342
7525
|
readonly pid: number;
|
|
7343
7526
|
readonly cwd: string;
|
|
7344
7527
|
readonly args: readonly string[];
|
|
7528
|
+
readonly foregroundProcess: string | null;
|
|
7345
7529
|
readonly exitCode?: number | undefined;
|
|
7346
7530
|
};
|
|
7347
7531
|
};
|
|
7348
|
-
readonly type: "pty.
|
|
7532
|
+
readonly type: "persistent-pty.added";
|
|
7349
7533
|
readonly created: number;
|
|
7350
7534
|
readonly location?: {
|
|
7351
7535
|
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
@@ -7357,10 +7541,10 @@ export declare const Api: import("@opencode-ai/protocol/api").Api<LocationMiddle
|
|
|
7357
7541
|
} | {
|
|
7358
7542
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7359
7543
|
readonly data: {
|
|
7360
|
-
readonly
|
|
7361
|
-
readonly
|
|
7544
|
+
readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
|
|
7545
|
+
readonly ptyID: string & import("effect/Brand").Brand<"PtyID">;
|
|
7362
7546
|
};
|
|
7363
|
-
readonly type: "pty.
|
|
7547
|
+
readonly type: "persistent-pty.removed";
|
|
7364
7548
|
readonly created: number;
|
|
7365
7549
|
readonly location?: {
|
|
7366
7550
|
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
@@ -7372,9 +7556,21 @@ export declare const Api: import("@opencode-ai/protocol/api").Api<LocationMiddle
|
|
|
7372
7556
|
} | {
|
|
7373
7557
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7374
7558
|
readonly data: {
|
|
7375
|
-
readonly id: string & import("effect/Brand").Brand<"
|
|
7559
|
+
readonly id: string & import("effect/Brand").Brand<"Plugin.ID">;
|
|
7376
7560
|
};
|
|
7377
|
-
readonly type: "
|
|
7561
|
+
readonly type: "plugin.added";
|
|
7562
|
+
readonly created: number;
|
|
7563
|
+
readonly location?: {
|
|
7564
|
+
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
7565
|
+
readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
|
|
7566
|
+
} | undefined;
|
|
7567
|
+
readonly metadata?: {
|
|
7568
|
+
readonly [x: string]: unknown;
|
|
7569
|
+
} | undefined;
|
|
7570
|
+
} | {
|
|
7571
|
+
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7572
|
+
readonly data: {};
|
|
7573
|
+
readonly type: "plugin.updated";
|
|
7378
7574
|
readonly created: number;
|
|
7379
7575
|
readonly location?: {
|
|
7380
7576
|
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PersistentPty } from "@opencode-ai/core/persistent-pty";
|
|
2
|
+
import { PtyTicket } from "@opencode-ai/core/pty/ticket";
|
|
3
|
+
export declare const PersistentPtyHandler: import("effect/Layer").Layer<import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.experimental">, never, PtyTicket.Service | PersistentPty.Service | (import("@opencode-ai/protocol/middleware/schema-error").SchemaErrorMiddleware | import("@opencode-ai/protocol/middleware/authorization").Authorization)>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { PersistentPty } from "@opencode-ai/core/persistent-pty";
|
|
2
|
+
import { PtyTicket } from "@opencode-ai/core/pty/ticket";
|
|
3
|
+
import { ForbiddenError, PtyNotFoundError, ServiceUnavailableError } from "@opencode-ai/protocol/errors";
|
|
4
|
+
import {
|
|
5
|
+
PTY_CONNECT_TICKET_QUERY,
|
|
6
|
+
PTY_CONNECT_TOKEN_HEADER,
|
|
7
|
+
PTY_CONNECT_TOKEN_HEADER_VALUE
|
|
8
|
+
} from "@opencode-ai/protocol/groups/persistent-pty";
|
|
9
|
+
import { Effect, Queue, Semaphore } from "effect";
|
|
10
|
+
import { HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
|
11
|
+
import { HttpApiBuilder, HttpApiSchema } from "effect/unstable/httpapi";
|
|
12
|
+
import { Socket } from "effect/unstable/socket";
|
|
13
|
+
import { Api } from "../api";
|
|
14
|
+
import { CorsConfig, isAllowedRequestOrigin } from "../cors";
|
|
15
|
+
export const PersistentPtyHandler = HttpApiBuilder.group(Api, "server.experimental", (handlers) => Effect.gen(function* () {
|
|
16
|
+
const tickets = yield* PtyTicket.Service, cors = yield* CorsConfig, pty = yield* PersistentPty.Service;
|
|
17
|
+
return handlers.handle("persistentPty.list", Effect.fn(function* (ctx) {
|
|
18
|
+
return { data: yield* pty.list(ctx.params.sessionID).pipe(mapUnavailable) };
|
|
19
|
+
})).handle("persistentPty.create", Effect.fn(function* (ctx) {
|
|
20
|
+
return {
|
|
21
|
+
data: yield* pty.create(ctx.params.sessionID, {
|
|
22
|
+
command: ctx.payload.command,
|
|
23
|
+
args: ctx.payload.args,
|
|
24
|
+
cwd: ctx.payload.cwd,
|
|
25
|
+
title: ctx.payload.title,
|
|
26
|
+
env: ctx.payload.env,
|
|
27
|
+
cols: ctx.payload.size?.cols,
|
|
28
|
+
rows: ctx.payload.size?.rows
|
|
29
|
+
}).pipe(Effect.catchTag("PersistentPty.UnavailableError", unavailable))
|
|
30
|
+
};
|
|
31
|
+
})).handle("persistentPty.shutdown", Effect.fn(function* () {
|
|
32
|
+
yield* pty.shutdown().pipe(mapUnavailable);
|
|
33
|
+
return HttpApiSchema.NoContent.make();
|
|
34
|
+
})).handle("persistentPty.get", Effect.fn(function* (ctx) {
|
|
35
|
+
return { data: yield* pty.get(ctx.params.ptyID).pipe(mapTerminalError) };
|
|
36
|
+
})).handle("persistentPty.update", Effect.fn(function* (ctx) {
|
|
37
|
+
yield* pty.resize(ctx.params.ptyID, ctx.payload.size.cols, ctx.payload.size.rows, ctx.payload.attachmentID).pipe(mapTerminalError);
|
|
38
|
+
return { data: yield* pty.get(ctx.params.ptyID).pipe(mapTerminalError) };
|
|
39
|
+
})).handle("persistentPty.snapshot", Effect.fn(function* (ctx) {
|
|
40
|
+
return { data: yield* pty.snapshot(ctx.params.ptyID).pipe(mapTerminalError) };
|
|
41
|
+
})).handle("persistentPty.remove", Effect.fn(function* (ctx) {
|
|
42
|
+
yield* pty.remove(ctx.params.ptyID).pipe(mapTerminalError);
|
|
43
|
+
return HttpApiSchema.NoContent.make();
|
|
44
|
+
})).handle("persistentPty.connectToken", Effect.fn(function* (ctx) {
|
|
45
|
+
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
46
|
+
if (request.headers[PTY_CONNECT_TOKEN_HEADER] !== PTY_CONNECT_TOKEN_HEADER_VALUE || !isAllowedRequestOrigin(request.headers.origin, request.headers.host, cors))
|
|
47
|
+
return yield* new ForbiddenError({ message: "Invalid persistent PTY connect token request" });
|
|
48
|
+
yield* pty.get(ctx.params.ptyID).pipe(mapTerminalError);
|
|
49
|
+
return { data: yield* tickets.issue({ ptyID: ctx.params.ptyID }) };
|
|
50
|
+
})).handleRaw("persistentPty.connect", Effect.fn("PersistentPtyHandler.connect")(function* (ctx) {
|
|
51
|
+
if (!(yield* pty.get(ctx.params.ptyID).pipe(Effect.as(!0), Effect.catchTag("PersistentPty.NotFoundError", () => Effect.succeed(!1)), Effect.catchTag("PersistentPty.UnavailableError", () => Effect.succeed(!1)))))
|
|
52
|
+
return HttpServerResponse.empty({ status: 404 });
|
|
53
|
+
const url = new URL(ctx.request.url, "http://localhost"), ticket = url.searchParams.get(PTY_CONNECT_TICKET_QUERY);
|
|
54
|
+
if (ticket) {
|
|
55
|
+
if (!(isAllowedRequestOrigin(ctx.request.headers.origin, ctx.request.headers.host, cors) ? yield* tickets.consume({ ticket, ptyID: ctx.params.ptyID }) : !1))
|
|
56
|
+
return HttpServerResponse.empty({ status: 403 });
|
|
57
|
+
}
|
|
58
|
+
const cursor = Number(url.searchParams.get("cursor") ?? "0"), role = url.searchParams.get("role") === "observer" ? "observer" : "controller", framedInput = url.searchParams.get("input_protocol") === "1", attachmentID = url.searchParams.get("attachment_id") ?? crypto.randomUUID();
|
|
59
|
+
if (!Number.isSafeInteger(cursor) || cursor < 0)
|
|
60
|
+
return HttpServerResponse.empty({ status: 400 });
|
|
61
|
+
const socket = yield* Effect.orDie(ctx.request.upgrade), write = yield* socket.writer, outbox = yield* Queue.unbounded(), input = yield* Semaphore.make(1), attachment = yield* pty.attach(ctx.params.ptyID, {
|
|
62
|
+
cursor,
|
|
63
|
+
attachmentID,
|
|
64
|
+
role,
|
|
65
|
+
takeover: url.searchParams.get("takeover") === "true",
|
|
66
|
+
onEvent: (event) => {
|
|
67
|
+
if (event.type === "output")
|
|
68
|
+
Queue.offerUnsafe(outbox, event.data);
|
|
69
|
+
if (event.type === "resized")
|
|
70
|
+
Queue.offerUnsafe(outbox, JSON.stringify({ ...event, checkpoint: Buffer.from(event.checkpoint).toString("base64") }));
|
|
71
|
+
if (event.type !== "output" && event.type !== "resized")
|
|
72
|
+
Queue.offerUnsafe(outbox, JSON.stringify(event));
|
|
73
|
+
},
|
|
74
|
+
onEnd: () => Queue.offerUnsafe(outbox, new Socket.CloseEvent(1000))
|
|
75
|
+
}).pipe(Effect.catchTags({
|
|
76
|
+
"PersistentPty.NotFoundError": () => Effect.succeed(void 0),
|
|
77
|
+
"PersistentPty.UnavailableError": () => Effect.succeed(void 0)
|
|
78
|
+
}));
|
|
79
|
+
if (!attachment)
|
|
80
|
+
return HttpServerResponse.empty({ status: 404 });
|
|
81
|
+
Queue.offerUnsafe(outbox, JSON.stringify({
|
|
82
|
+
type: "attached",
|
|
83
|
+
attachmentID,
|
|
84
|
+
inputProtocol: framedInput ? 1 : 0,
|
|
85
|
+
info: attachment.info,
|
|
86
|
+
role: attachment.role,
|
|
87
|
+
generation: attachment.generation,
|
|
88
|
+
replay: {
|
|
89
|
+
requestedOffset: attachment.replay.requestedOffset,
|
|
90
|
+
availableOffset: attachment.replay.availableOffset,
|
|
91
|
+
endOffset: attachment.replay.endOffset,
|
|
92
|
+
truncated: attachment.replay.truncated
|
|
93
|
+
}
|
|
94
|
+
}));
|
|
95
|
+
if (attachment.replay.data.length > 0)
|
|
96
|
+
Queue.offerUnsafe(outbox, attachment.replay.data);
|
|
97
|
+
Queue.offerUnsafe(outbox, JSON.stringify({ type: "replay_complete", endOffset: attachment.replay.endOffset }));
|
|
98
|
+
attachment.activate();
|
|
99
|
+
const drain = Effect.gen(function* () {
|
|
100
|
+
while (!0) {
|
|
101
|
+
const item = yield* Queue.take(outbox);
|
|
102
|
+
yield* write(item);
|
|
103
|
+
if (item instanceof Socket.CloseEvent)
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
yield* Effect.race(drain, socket.runRaw((message) => input.withPermit(Effect.suspend(() => {
|
|
108
|
+
const data = typeof message === "string" ? Buffer.from(message) : message;
|
|
109
|
+
if (!framedInput)
|
|
110
|
+
return pty.input(ctx.params.ptyID, attachmentID, attachment.info.size.cols, attachment.info.size.rows, data).pipe(Effect.ignore);
|
|
111
|
+
if (data.byteLength < 5)
|
|
112
|
+
return Effect.void;
|
|
113
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength), type = data[0], cols = view.getUint16(1), rows = view.getUint16(3);
|
|
114
|
+
if (type !== 0 && type !== 1 || cols === 0 || rows === 0)
|
|
115
|
+
return Effect.void;
|
|
116
|
+
if (type === 0)
|
|
117
|
+
return pty.control(ctx.params.ptyID, attachmentID, cols, rows).pipe(Effect.ignore);
|
|
118
|
+
return pty.input(ctx.params.ptyID, attachmentID, cols, rows, data.subarray(5)).pipe(Effect.ignore);
|
|
119
|
+
})))).pipe(Effect.catchReason("SocketError", "SocketCloseError", () => Effect.void), Effect.ensuring(Effect.sync(() => attachment.detach())), Effect.orDie);
|
|
120
|
+
return HttpServerResponse.empty();
|
|
121
|
+
}));
|
|
122
|
+
}));
|
|
123
|
+
const mapUnavailable = (effect) => effect.pipe(Effect.catchTag("PersistentPty.UnavailableError", unavailable)), mapTerminalError = (effect) => effect.pipe(Effect.catchTags({
|
|
124
|
+
"PersistentPty.NotFoundError": (error) => new PtyNotFoundError({ ptyID: error.ptyID, message: `PTY session not found: ${error.ptyID}` }),
|
|
125
|
+
"PersistentPty.UnavailableError": unavailable
|
|
126
|
+
})), unavailable = (error) => new ServiceUnavailableError({ message: error.message, service: "opencode-pty" });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Project } from "@opencode-ai/core/project";
|
|
2
|
-
export declare const ProjectHandler: import("effect/Layer").Layer<import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.project">, never, import("@opencode-ai/protocol/middleware/schema-error").SchemaErrorMiddleware | import("@opencode-ai/protocol/middleware/authorization").Authorization | import("../location").LocationMiddleware
|
|
2
|
+
export declare const ProjectHandler: import("effect/Layer").Layer<import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.project">, never, import("effect/unstable/http/HttpRouter").Request<"Requires", Project.Service> | (import("@opencode-ai/protocol/middleware/schema-error").SchemaErrorMiddleware | import("@opencode-ai/protocol/middleware/authorization").Authorization | import("../location").LocationMiddleware)>;
|
package/dist/handlers/project.js
CHANGED
|
@@ -3,7 +3,11 @@ import { Project } from "@opencode-ai/core/project";
|
|
|
3
3
|
import { Effect } from "effect";
|
|
4
4
|
import { HttpApiBuilder } from "effect/unstable/httpapi";
|
|
5
5
|
import { Api } from "../api";
|
|
6
|
-
|
|
6
|
+
import { ProjectNotFoundError } from "@opencode-ai/protocol/errors";
|
|
7
|
+
export const ProjectHandler = HttpApiBuilder.group(Api, "server.project", (handlers) => handlers.handle("project.list", () => Project.Service.use((project) => project.list())).handle("project.update", (ctx) => Project.Service.use((project) => project.update({ ...ctx.payload, projectID: ctx.params.projectID }).pipe(Effect.mapError(() => new ProjectNotFoundError({
|
|
8
|
+
projectID: ctx.params.projectID,
|
|
9
|
+
message: `Project not found: ${ctx.params.projectID}`
|
|
10
|
+
}))))).handle("project.current", () => Location.Service.use((location) => Effect.succeed({
|
|
7
11
|
id: location.project.id,
|
|
8
12
|
directory: location.project.directory,
|
|
9
13
|
canonical: location.project.canonical
|
package/dist/handlers/session.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Session } from "@opencode-ai/core/session";
|
|
2
2
|
import { SessionStats } from "@opencode-ai/core/session/stats";
|
|
3
|
+
import { SessionTitle } from "@opencode-ai/core/session/title";
|
|
3
4
|
import { SessionTransfer } from "@opencode-ai/core/session/transfer";
|
|
4
5
|
import { InstructionEntry } from "@opencode-ai/core/session/instruction-entry";
|
|
5
6
|
import { DateTime, Effect, Stream } from "effect";
|
|
@@ -125,7 +126,11 @@ export const SessionHandler = HttpApiBuilder.group(Api, "server.session", (handl
|
|
|
125
126
|
yield* session.switchModel({ sessionID: ctx.params.sessionID, model: ctx.payload.model }).pipe(Effect.catchTag("Session.NotFoundError", missingSession));
|
|
126
127
|
return HttpApiSchema.NoContent.make();
|
|
127
128
|
})).handle("session.rename", Effect.fn(function* (ctx) {
|
|
128
|
-
|
|
129
|
+
if (ctx.payload.title) {
|
|
130
|
+
yield* session.rename({ sessionID: ctx.params.sessionID, title: ctx.payload.title }).pipe(Effect.catchTag("Session.NotFoundError", missingSession));
|
|
131
|
+
return HttpApiSchema.NoContent.make();
|
|
132
|
+
}
|
|
133
|
+
yield* (yield* SessionTitle.Service).generate(ctx.params.sessionID);
|
|
129
134
|
return HttpApiSchema.NoContent.make();
|
|
130
135
|
})).handle("session.move", Effect.fn(function* (ctx) {
|
|
131
136
|
yield* session.move({
|
package/dist/handlers/vcs.js
CHANGED
|
@@ -8,6 +8,8 @@ export const VcsHandler = HttpApiBuilder.group(Api, "server.vcs", (handlers) =>
|
|
|
8
8
|
return yield* (yield* Vcs.Service).info();
|
|
9
9
|
}))).handle("vcs.status", () => response(Effect.gen(function* () {
|
|
10
10
|
return yield* (yield* Vcs.Service).status();
|
|
11
|
+
}))).handle("vcs.branches", (ctx) => response(Effect.gen(function* () {
|
|
12
|
+
return yield* (yield* Vcs.Service).branches({ search: ctx.query.search, limit: Math.min(ctx.query.limit ?? 50, 100) });
|
|
11
13
|
}))).handle("vcs.diff", (ctx) => response(Effect.gen(function* () {
|
|
12
14
|
return yield* (yield* Vcs.Service).diff(ctx.query.mode, { context: ctx.query.context });
|
|
13
15
|
})));
|
package/dist/handlers.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Layer } from "effect";
|
|
2
|
-
export declare const handlers: Layer.Layer<import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.generate"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.message"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.model"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.provider"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.session"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.permission"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.fs"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.form"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.command"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.skill"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.event"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.agent"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.plugin"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.health"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.server"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.debug"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.pty"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.shell"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.reference"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.location"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.integration"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.websearch"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.mcp"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.credential"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.project"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.worktree"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.vcs"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.migration"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.config"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.workspace">, never, import("@opencode-ai/protocol/middleware/schema-error").SchemaErrorMiddleware | import("@opencode-ai/protocol/middleware/authorization").Authorization | import("@opencode-ai/util/global").Service | import("@opencode-ai/core/bus").Service | import("@opencode-ai/core/workspace").Service | import("@opencode-ai/core/location-service-map").Service | import("@opencode-ai/core/worktree").Service | import("@opencode-ai/core/session").Service | import("./location").LocationMiddleware | import("./middleware/form-location").FormLocationMiddleware | import("./middleware/session-location").SessionLocationMiddleware | import("@opencode-ai/core/pty/ticket").Service | import("@opencode-ai/core/session/transfer").Service | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode-ai/core/database/database").Service> | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode-ai/core/permission/saved").Service> | import("effect/unstable/http/HttpRouter").Request<"Requires", import("./server-info").Service> | import("./pty-environment").Service | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode-ai/core/wellknown").Service> | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode-ai/core/project").Service>>;
|
|
2
|
+
export declare const handlers: Layer.Layer<import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.generate"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.message"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.model"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.provider"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.session"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.permission"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.fs"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.form"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.command"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.skill"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.event"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.agent"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.plugin"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.health"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.server"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.debug"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.pty"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.experimental"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.shell"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.reference"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.location"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.integration"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.websearch"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.mcp"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.credential"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.project"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.worktree"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.vcs"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.migration"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.config"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.workspace">, never, import("@opencode-ai/protocol/middleware/schema-error").SchemaErrorMiddleware | import("@opencode-ai/protocol/middleware/authorization").Authorization | import("@opencode-ai/util/global").Service | import("@opencode-ai/core/bus").Service | import("@opencode-ai/core/workspace").Service | import("@opencode-ai/core/location-service-map").Service | import("@opencode-ai/core/worktree").Service | import("@opencode-ai/core/session").Service | import("./location").LocationMiddleware | import("./middleware/form-location").FormLocationMiddleware | import("./middleware/session-location").SessionLocationMiddleware | import("@opencode-ai/core/pty/ticket").Service | import("@opencode-ai/core/persistent-pty/index").Service | import("@opencode-ai/core/session/transfer").Service | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode-ai/core/database/database").Service> | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode-ai/core/permission/saved").Service> | import("effect/unstable/http/HttpRouter").Request<"Requires", import("./server-info").Service> | import("./pty-environment").Service | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode-ai/core/wellknown").Service> | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode-ai/core/project").Service>>;
|
package/dist/handlers.js
CHANGED
|
@@ -16,6 +16,7 @@ import { HealthHandler } from "./handlers/health";
|
|
|
16
16
|
import { ServerHandler } from "./handlers/server";
|
|
17
17
|
import { DebugHandler } from "./handlers/debug";
|
|
18
18
|
import { PtyHandler } from "./handlers/pty";
|
|
19
|
+
import { PersistentPtyHandler } from "./handlers/persistent-pty";
|
|
19
20
|
import { ShellHandler } from "./handlers/shell";
|
|
20
21
|
import { ReferenceHandler } from "./handlers/reference";
|
|
21
22
|
import { LocationHandler } from "./handlers/location";
|
|
@@ -30,4 +31,4 @@ import { EventFeed } from "./event-feed";
|
|
|
30
31
|
import { MigrationHandler } from "./handlers/migration";
|
|
31
32
|
import { ConfigHandler } from "./handlers/config";
|
|
32
33
|
import { WorkspaceHandler } from "./handlers/workspace";
|
|
33
|
-
export const handlers = Layer.mergeAll(HealthHandler, ServerHandler, DebugHandler, MigrationHandler, LocationHandler, AgentHandler, PluginHandler, SessionHandler, MessageHandler, ModelHandler, GenerateHandler, ProviderHandler, IntegrationHandler, WebSearchHandler, McpHandler, CredentialHandler, ProjectHandler, FormHandler, PermissionHandler, FileSystemHandler, CommandHandler, SkillHandler, EventHandler.pipe(Layer.provide(EventFeed.layer)), PtyHandler, ShellHandler, ReferenceHandler, WorktreeHandler, WorkspaceHandler, VcsHandler, ConfigHandler);
|
|
34
|
+
export const handlers = Layer.mergeAll(HealthHandler, ServerHandler, DebugHandler, MigrationHandler, LocationHandler, AgentHandler, PluginHandler, SessionHandler, MessageHandler, ModelHandler, GenerateHandler, ProviderHandler, IntegrationHandler, WebSearchHandler, McpHandler, CredentialHandler, ProjectHandler, FormHandler, PermissionHandler, FileSystemHandler, CommandHandler, SkillHandler, EventHandler.pipe(Layer.provide(EventFeed.layer)), PtyHandler, PersistentPtyHandler, ShellHandler, ReferenceHandler, WorktreeHandler, WorkspaceHandler, VcsHandler, ConfigHandler);
|
package/dist/location.d.ts
CHANGED
|
@@ -6,12 +6,12 @@ import { HttpApiMiddleware } from "effect/unstable/httpapi";
|
|
|
6
6
|
export type LocationServices = Layer.Success<ReturnType<(typeof LocationServiceMap.Service)["get"]>>;
|
|
7
7
|
declare const LocationMiddleware_base: HttpApiMiddleware.ServiceClass<LocationMiddleware, "@opencode/HttpApiLocation", {
|
|
8
8
|
requires: never;
|
|
9
|
-
provides: Location.Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/
|
|
9
|
+
provides: Location.Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/permission").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/vcs").Service | import("@opencode-ai/core/location-mutation").Service | import("@opencode-ai/core/tool/read-filesystem").Service | import("@opencode-ai/core/session/instructions").Service | import("@opencode-ai/core/shell").Service | import("@opencode-ai/core/shell/select").Service | import("@opencode-ai/core/instruction-discovery").Service | import("@opencode-ai/core/session/compaction").Service | import("@opencode-ai/core/snapshot").Service | import("@opencode-ai/core/tool-output").Service | import("@opencode-ai/core/session/runner/model").Service | import("@opencode-ai/core/session/model-transport").Service | import("@opencode-ai/core/pty").Service | import("@opencode-ai/core/instructions/builtins").Service | import("@opencode-ai/core/skill/instructions").Service | import("@opencode-ai/core/reference/instructions").Service | import("@opencode-ai/core/session/instruction-entry").Service | import("@opencode-ai/core/session/generate").Service | import("@opencode-ai/core/tool/mcp").Service | import("@opencode-ai/core/session/title").Service | import("@opencode-ai/core/session/runner/index").Service | import("@opencode-ai/core/filesystem/location-watcher").Service;
|
|
10
10
|
error: never;
|
|
11
11
|
clientError: never;
|
|
12
12
|
requiredForClient: false;
|
|
13
13
|
security: never;
|
|
14
|
-
}, HttpApiMiddleware.HttpApiMiddleware<Location.Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/
|
|
14
|
+
}, HttpApiMiddleware.HttpApiMiddleware<Location.Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/permission").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/vcs").Service | import("@opencode-ai/core/location-mutation").Service | import("@opencode-ai/core/tool/read-filesystem").Service | import("@opencode-ai/core/session/instructions").Service | import("@opencode-ai/core/shell").Service | import("@opencode-ai/core/shell/select").Service | import("@opencode-ai/core/instruction-discovery").Service | import("@opencode-ai/core/session/compaction").Service | import("@opencode-ai/core/snapshot").Service | import("@opencode-ai/core/tool-output").Service | import("@opencode-ai/core/session/runner/model").Service | import("@opencode-ai/core/session/model-transport").Service | import("@opencode-ai/core/pty").Service | import("@opencode-ai/core/instructions/builtins").Service | import("@opencode-ai/core/skill/instructions").Service | import("@opencode-ai/core/reference/instructions").Service | import("@opencode-ai/core/session/instruction-entry").Service | import("@opencode-ai/core/session/generate").Service | import("@opencode-ai/core/tool/mcp").Service | import("@opencode-ai/core/session/title").Service | import("@opencode-ai/core/session/runner/index").Service | import("@opencode-ai/core/filesystem/location-watcher").Service, never, never>>;
|
|
15
15
|
export declare class LocationMiddleware extends LocationMiddleware_base {
|
|
16
16
|
}
|
|
17
17
|
export declare function response<A, E, R>(data: Effect.Effect<A, E, R>): Effect.Effect<{
|
|
@@ -3,6 +3,7 @@ import { UnauthorizedError } from "@opencode-ai/protocol/errors";
|
|
|
3
3
|
import { Authorization } from "@opencode-ai/protocol/middleware/authorization";
|
|
4
4
|
export { Authorization } from "@opencode-ai/protocol/middleware/authorization";
|
|
5
5
|
import { hasPtyConnectTicketURL } from "@opencode-ai/protocol/groups/pty";
|
|
6
|
+
import { hasPersistentPtyConnectTicketURL } from "@opencode-ai/protocol/groups/persistent-pty";
|
|
6
7
|
import { Effect, Encoding, Layer, Redacted } from "effect";
|
|
7
8
|
import { HttpEffect, HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
|
8
9
|
const AUTH_TOKEN_QUERY = "auth_token", WWW_AUTHENTICATE = 'Basic realm="Secure Area"';
|
|
@@ -37,8 +38,8 @@ export const authorizationLayer = Layer.effect(Authorization, Effect.gen(functio
|
|
|
37
38
|
if (!ServerAuth.required(config))
|
|
38
39
|
return Authorization.of((effect) => effect);
|
|
39
40
|
return Authorization.of((effect) => Effect.gen(function* () {
|
|
40
|
-
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
41
|
-
if (hasPtyConnectTicketURL(
|
|
41
|
+
const request = yield* HttpServerRequest.HttpServerRequest, url = new URL(request.url, "http://localhost");
|
|
42
|
+
if (hasPtyConnectTicketURL(url) || hasPersistentPtyConnectTicketURL(url))
|
|
42
43
|
return yield* effect;
|
|
43
44
|
if (yield* authorizedRequest(request, config))
|
|
44
45
|
return yield* effect;
|
|
@@ -6,12 +6,12 @@ import { Layer } from "effect";
|
|
|
6
6
|
import { HttpApiMiddleware } from "effect/unstable/httpapi";
|
|
7
7
|
declare const FormLocationMiddleware_base: HttpApiMiddleware.ServiceClass<FormLocationMiddleware, "@opencode/HttpApiFormLocation", {
|
|
8
8
|
requires: never;
|
|
9
|
-
provides: Location.Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/
|
|
9
|
+
provides: Location.Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/permission").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/vcs").Service | import("@opencode-ai/core/location-mutation").Service | import("@opencode-ai/core/tool/read-filesystem").Service | import("@opencode-ai/core/session/instructions").Service | import("@opencode-ai/core/shell").Service | import("@opencode-ai/core/shell/select").Service | import("@opencode-ai/core/instruction-discovery").Service | import("@opencode-ai/core/session/compaction").Service | import("@opencode-ai/core/snapshot").Service | import("@opencode-ai/core/tool-output").Service | import("@opencode-ai/core/session/runner/model").Service | import("@opencode-ai/core/session/model-transport").Service | import("@opencode-ai/core/pty").Service | import("@opencode-ai/core/instructions/builtins").Service | import("@opencode-ai/core/skill/instructions").Service | import("@opencode-ai/core/reference/instructions").Service | import("@opencode-ai/core/session/instruction-entry").Service | import("@opencode-ai/core/session/generate").Service | import("@opencode-ai/core/tool/mcp").Service | import("@opencode-ai/core/session/title").Service | import("@opencode-ai/core/session/runner/index").Service | import("@opencode-ai/core/filesystem/location-watcher").Service;
|
|
10
10
|
error: readonly [typeof InvalidRequestError, typeof SessionNotFoundError];
|
|
11
11
|
clientError: never;
|
|
12
12
|
requiredForClient: false;
|
|
13
13
|
security: never;
|
|
14
|
-
}, HttpApiMiddleware.HttpApiMiddleware<Location.Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/
|
|
14
|
+
}, HttpApiMiddleware.HttpApiMiddleware<Location.Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/permission").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/vcs").Service | import("@opencode-ai/core/location-mutation").Service | import("@opencode-ai/core/tool/read-filesystem").Service | import("@opencode-ai/core/session/instructions").Service | import("@opencode-ai/core/shell").Service | import("@opencode-ai/core/shell/select").Service | import("@opencode-ai/core/instruction-discovery").Service | import("@opencode-ai/core/session/compaction").Service | import("@opencode-ai/core/snapshot").Service | import("@opencode-ai/core/tool-output").Service | import("@opencode-ai/core/session/runner/model").Service | import("@opencode-ai/core/session/model-transport").Service | import("@opencode-ai/core/pty").Service | import("@opencode-ai/core/instructions/builtins").Service | import("@opencode-ai/core/skill/instructions").Service | import("@opencode-ai/core/reference/instructions").Service | import("@opencode-ai/core/session/instruction-entry").Service | import("@opencode-ai/core/session/generate").Service | import("@opencode-ai/core/tool/mcp").Service | import("@opencode-ai/core/session/title").Service | import("@opencode-ai/core/session/runner/index").Service | import("@opencode-ai/core/filesystem/location-watcher").Service, readonly [typeof InvalidRequestError, typeof SessionNotFoundError], never>>;
|
|
15
15
|
export declare class FormLocationMiddleware extends FormLocationMiddleware_base {
|
|
16
16
|
}
|
|
17
17
|
export declare const formLocationLayer: Layer.Layer<FormLocationMiddleware, never, Database.Service | LocationServiceMap.Service>;
|
|
@@ -6,12 +6,12 @@ import { HttpApiMiddleware } from "effect/unstable/httpapi";
|
|
|
6
6
|
import { InvalidRequestError, SessionNotFoundError } from "@opencode-ai/protocol/errors";
|
|
7
7
|
declare const SessionLocationMiddleware_base: HttpApiMiddleware.ServiceClass<SessionLocationMiddleware, "@opencode/HttpApiSessionLocation", {
|
|
8
8
|
requires: never;
|
|
9
|
-
provides: Location.Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/
|
|
9
|
+
provides: Location.Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/permission").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/vcs").Service | import("@opencode-ai/core/location-mutation").Service | import("@opencode-ai/core/tool/read-filesystem").Service | import("@opencode-ai/core/session/instructions").Service | import("@opencode-ai/core/shell").Service | import("@opencode-ai/core/shell/select").Service | import("@opencode-ai/core/instruction-discovery").Service | import("@opencode-ai/core/session/compaction").Service | import("@opencode-ai/core/snapshot").Service | import("@opencode-ai/core/tool-output").Service | import("@opencode-ai/core/session/runner/model").Service | import("@opencode-ai/core/session/model-transport").Service | import("@opencode-ai/core/pty").Service | import("@opencode-ai/core/instructions/builtins").Service | import("@opencode-ai/core/skill/instructions").Service | import("@opencode-ai/core/reference/instructions").Service | import("@opencode-ai/core/session/instruction-entry").Service | import("@opencode-ai/core/session/generate").Service | import("@opencode-ai/core/tool/mcp").Service | import("@opencode-ai/core/session/title").Service | import("@opencode-ai/core/session/runner/index").Service | import("@opencode-ai/core/filesystem/location-watcher").Service;
|
|
10
10
|
error: readonly [typeof InvalidRequestError, typeof SessionNotFoundError];
|
|
11
11
|
clientError: never;
|
|
12
12
|
requiredForClient: false;
|
|
13
13
|
security: never;
|
|
14
|
-
}, HttpApiMiddleware.HttpApiMiddleware<Location.Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/
|
|
14
|
+
}, HttpApiMiddleware.HttpApiMiddleware<Location.Service | import("@opencode-ai/core/agent").Service | import("@opencode-ai/core/aisdk").Service | import("@opencode-ai/core/form").Service | import("@opencode-ai/core/integration").Service | import("@opencode-ai/core/catalog").Service | import("@opencode-ai/core/command").Service | import("@opencode-ai/core/config").Service | import("@opencode-ai/core/environment/environment").Service | import("@opencode-ai/core/file-mutation").Service | import("@opencode-ai/core/formatter").Service | import("@opencode-ai/core/filesystem/search").Service | import("@opencode-ai/core/filesystem").Service | import("@opencode-ai/core/model-resolver").Service | import("@opencode-ai/core/generate").Service | import("@opencode-ai/core/image").Service | import("@opencode-ai/core/plugin/supervisor-service").Service | import("@opencode-ai/core/mcp/index").Service | import("@opencode-ai/core/reference").Service | import("@opencode-ai/core/websearch").Service | import("@opencode-ai/core/plugin").Service | import("@opencode-ai/core/permission").Service | import("@opencode-ai/core/skill").Service | import("@opencode-ai/core/tool").Service | import("@opencode-ai/core/vcs").Service | import("@opencode-ai/core/location-mutation").Service | import("@opencode-ai/core/tool/read-filesystem").Service | import("@opencode-ai/core/session/instructions").Service | import("@opencode-ai/core/shell").Service | import("@opencode-ai/core/shell/select").Service | import("@opencode-ai/core/instruction-discovery").Service | import("@opencode-ai/core/session/compaction").Service | import("@opencode-ai/core/snapshot").Service | import("@opencode-ai/core/tool-output").Service | import("@opencode-ai/core/session/runner/model").Service | import("@opencode-ai/core/session/model-transport").Service | import("@opencode-ai/core/pty").Service | import("@opencode-ai/core/instructions/builtins").Service | import("@opencode-ai/core/skill/instructions").Service | import("@opencode-ai/core/reference/instructions").Service | import("@opencode-ai/core/session/instruction-entry").Service | import("@opencode-ai/core/session/generate").Service | import("@opencode-ai/core/tool/mcp").Service | import("@opencode-ai/core/session/title").Service | import("@opencode-ai/core/session/runner/index").Service | import("@opencode-ai/core/filesystem/location-watcher").Service, readonly [typeof InvalidRequestError, typeof SessionNotFoundError], never>>;
|
|
15
15
|
export declare class SessionLocationMiddleware extends SessionLocationMiddleware_base {
|
|
16
16
|
}
|
|
17
17
|
export declare const sessionLocationLayer: Layer.Layer<SessionLocationMiddleware, never, Database.Service | LocationServiceMap.Service>;
|
package/dist/process.js
CHANGED
|
@@ -2,6 +2,7 @@ export * as ServerProcess from "./process";
|
|
|
2
2
|
import { NodeHttpServer } from "@effect/platform-node";
|
|
3
3
|
import { SessionRestart } from "@opencode-ai/core/session/execution/restart";
|
|
4
4
|
import { hasPtyConnectTicketURL } from "@opencode-ai/protocol/groups/pty";
|
|
5
|
+
import { hasPersistentPtyConnectTicketURL } from "@opencode-ai/protocol/groups/persistent-pty";
|
|
5
6
|
import { Cause, Context, Effect, Exit, Latch, Layer, Option, Ref, Scope } from "effect";
|
|
6
7
|
import {
|
|
7
8
|
HttpMiddleware,
|
|
@@ -88,7 +89,7 @@ function dispatch(password, status, application, version) {
|
|
|
88
89
|
return yield* healthResponse(status, version);
|
|
89
90
|
}
|
|
90
91
|
const state = yield* status.current, app = yield* Ref.get(application), ready = state.type === "ready" && Option.isSome(app);
|
|
91
|
-
if ((!ready || !hasPtyConnectTicketURL(url)) && !(yield* authorizedRequest(request, auth)))
|
|
92
|
+
if ((!ready || !hasPtyConnectTicketURL(url) && !hasPersistentPtyConnectTicketURL(url)) && !(yield* authorizedRequest(request, auth)))
|
|
92
93
|
return unauthorized();
|
|
93
94
|
if (ready)
|
|
94
95
|
return yield* app.value;
|
package/dist/routes.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Bus } from "@opencode-ai/core/bus";
|
|
|
4
4
|
import { Credential } from "@opencode-ai/core/credential";
|
|
5
5
|
import { PermissionSaved } from "@opencode-ai/core/permission/saved";
|
|
6
6
|
import { PtyTicket } from "@opencode-ai/core/pty/ticket";
|
|
7
|
+
import { PersistentPty } from "@opencode-ai/core/persistent-pty";
|
|
7
8
|
import { Project } from "@opencode-ai/core/project";
|
|
8
9
|
import { Session } from "@opencode-ai/core/session";
|
|
9
10
|
import { SessionTransfer } from "@opencode-ai/core/session/transfer";
|
|
@@ -20,5 +21,5 @@ import { HttpRouter } from "effect/unstable/http";
|
|
|
20
21
|
import { Layer } from "effect";
|
|
21
22
|
import { PtyEnvironment } from "./pty-environment";
|
|
22
23
|
import type { ServerOptions } from "./options";
|
|
23
|
-
export declare function createRoutes(options?: ServerOptions, serviceURLs?: () => ReadonlyArray<string>, overrides?: LayerNode.Replacements): Layer.Layer<Global.Service | Database.Service | Bus.Service | import("effect/unstable/http/HttpClient").HttpClient | Project.Service | Credential.Service | WellKnown.Service | Workspace.Service | Job.Service | LocationServiceMap.Service |
|
|
24
|
-
export declare function createEmbeddedRoutes(options?: ServerOptions, overrides?: LayerNode.Replacements): Layer.Layer<Global.Service | Database.Service | Bus.Service | import("effect/unstable/http/HttpClient").HttpClient | Project.Service | Credential.Service | WellKnown.Service | Workspace.Service | Job.Service | LocationServiceMap.Service |
|
|
24
|
+
export declare function createRoutes(options?: ServerOptions, serviceURLs?: () => ReadonlyArray<string>, overrides?: LayerNode.Replacements): Layer.Layer<Global.Service | Database.Service | Bus.Service | import("effect/unstable/http/HttpClient").HttpClient | Project.Service | Credential.Service | WellKnown.Service | Workspace.Service | Job.Service | LocationServiceMap.Service | PermissionSaved.Service | SdkPlugins.Service | Worktree.Service | Session.Service | SessionRestart.Service | PtyTicket.Service | PersistentPty.Service | SessionTransfer.Service | LocationActivity.Service | PtyEnvironment.Service | HttpRouter.HttpRouter, Error, import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("effect/unstable/http/Etag").Generator | import("effect/unstable/http/HttpPlatform").HttpPlatform>;
|
|
25
|
+
export declare function createEmbeddedRoutes(options?: ServerOptions, overrides?: LayerNode.Replacements): Layer.Layer<Global.Service | Database.Service | Bus.Service | import("effect/unstable/http/HttpClient").HttpClient | Project.Service | Credential.Service | WellKnown.Service | Workspace.Service | Job.Service | LocationServiceMap.Service | PermissionSaved.Service | SdkPlugins.Service | Worktree.Service | Session.Service | SessionRestart.Service | PtyTicket.Service | PersistentPty.Service | SessionTransfer.Service | LocationActivity.Service | PtyEnvironment.Service | HttpRouter.HttpRouter, Error, import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("effect/unstable/http/Etag").Generator | import("effect/unstable/http/HttpPlatform").HttpPlatform>;
|
package/dist/routes.js
CHANGED
|
@@ -11,6 +11,7 @@ import { Credential } from "@opencode-ai/core/credential";
|
|
|
11
11
|
import { Config } from "@opencode-ai/core/config";
|
|
12
12
|
import { PermissionSaved } from "@opencode-ai/core/permission/saved";
|
|
13
13
|
import { PtyTicket } from "@opencode-ai/core/pty/ticket";
|
|
14
|
+
import { PersistentPty } from "@opencode-ai/core/persistent-pty";
|
|
14
15
|
import { Project } from "@opencode-ai/core/project";
|
|
15
16
|
import { Session } from "@opencode-ai/core/session";
|
|
16
17
|
import { SessionTransfer } from "@opencode-ai/core/session/transfer";
|
|
@@ -57,6 +58,7 @@ const applicationServiceNodes = [
|
|
|
57
58
|
SdkPlugins.node,
|
|
58
59
|
PermissionSaved.node,
|
|
59
60
|
PtyTicket.node,
|
|
61
|
+
PersistentPty.node,
|
|
60
62
|
Credential.node,
|
|
61
63
|
WellKnown.node,
|
|
62
64
|
PtyEnvironment.node,
|
package/dist/workerd.js
CHANGED
|
@@ -37,7 +37,10 @@ export function replacements(options) {
|
|
|
37
37
|
];
|
|
38
38
|
}
|
|
39
39
|
const unavailable = (what) => Effect.die(Error(`${what} is unavailable in the workerd profile`)), vcsLayer = Layer.succeed(Vcs.Service, Vcs.Service.of({
|
|
40
|
+
transform: () => Effect.succeed({ dispose: Effect.void }),
|
|
41
|
+
reload: () => Effect.void,
|
|
40
42
|
info: () => Effect.succeed({ branch: {} }),
|
|
43
|
+
branches: () => Effect.succeed([]),
|
|
41
44
|
status: () => Effect.succeed([]),
|
|
42
45
|
diff: () => Effect.succeed([])
|
|
43
46
|
})), fileSystemLayer = Layer.succeed(FileSystem.Service, FileSystem.Service.of({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@opencode-ai/server",
|
|
4
|
-
"version": "0.0.0-beta-
|
|
4
|
+
"version": "0.0.0-beta-18219",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -29,11 +29,12 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@effect/platform-node": "4.0.0-rc.111",
|
|
32
|
-
"@
|
|
33
|
-
"@opencode-ai/
|
|
34
|
-
"@opencode-ai/
|
|
35
|
-
"@opencode-ai/
|
|
36
|
-
"@opencode-ai/
|
|
32
|
+
"@effect/platform-node-shared": "4.0.0-rc.111",
|
|
33
|
+
"@opencode-ai/core": "0.0.0-beta-18219",
|
|
34
|
+
"@opencode-ai/protocol": "0.0.0-beta-18219",
|
|
35
|
+
"@opencode-ai/schema": "0.0.0-beta-18219",
|
|
36
|
+
"@opencode-ai/simulation": "0.0.0-beta-18219",
|
|
37
|
+
"@opencode-ai/util": "0.0.0-beta-18219",
|
|
37
38
|
"drizzle-orm": "1.0.0-rc.5-169397b",
|
|
38
39
|
"effect": "4.0.0-rc.111"
|
|
39
40
|
},
|