@opencode-ai/server 0.0.0-dev-18112 → 0.0.0-dev-18122
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 +1 -1
- package/dist/handlers/generate.d.ts +3 -1
- package/dist/handlers/generate.js +6 -1
- package/dist/handlers/session.js +1 -2
- package/dist/handlers/workspace.d.ts +2 -0
- package/dist/handlers/workspace.js +11 -0
- package/dist/handlers.d.ts +1 -1
- package/dist/handlers.js +2 -1
- package/dist/routes.js +8 -10
- package/package.json +6 -6
package/dist/api.d.ts
CHANGED
|
@@ -7473,7 +7473,7 @@ export declare const Api: import("@opencode-ai/protocol/api").Api<LocationMiddle
|
|
|
7473
7473
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7474
7474
|
readonly data: {
|
|
7475
7475
|
readonly message: string;
|
|
7476
|
-
readonly variant: "error" | "
|
|
7476
|
+
readonly variant: "error" | "info" | "success" | "warning";
|
|
7477
7477
|
readonly duration: number;
|
|
7478
7478
|
readonly title?: string | undefined;
|
|
7479
7479
|
};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { LocationServiceMap } from "@opencode-ai/core/location-services";
|
|
2
|
+
import { Global } from "@opencode-ai/util/global";
|
|
3
|
+
export declare const GenerateHandler: import("effect/Layer").Layer<import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.generate">, never, Global.Service | LocationServiceMap.Service | (import("@opencode-ai/protocol/middleware/schema-error").SchemaErrorMiddleware | import("@opencode-ai/protocol/middleware/authorization").Authorization)>;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { Generate } from "@opencode-ai/core/generate";
|
|
2
|
+
import { Location } from "@opencode-ai/core/location";
|
|
3
|
+
import { LocationServiceMap } from "@opencode-ai/core/location-services";
|
|
4
|
+
import { AbsolutePath } from "@opencode-ai/core/schema";
|
|
2
5
|
import { InvalidRequestError, ServiceUnavailableError } from "@opencode-ai/protocol/errors";
|
|
6
|
+
import { Global } from "@opencode-ai/util/global";
|
|
3
7
|
import { Effect } from "effect";
|
|
4
8
|
import { HttpApiBuilder } from "effect/unstable/httpapi";
|
|
5
9
|
import { Api } from "../api";
|
|
6
10
|
export const GenerateHandler = HttpApiBuilder.group(Api, "server.generate", (handlers) => Effect.gen(function* () {
|
|
11
|
+
const global = yield* Global.Service, services = (yield* LocationServiceMap.Service).get(Location.Ref.make({ directory: AbsolutePath.make(global.config) }));
|
|
7
12
|
return handlers.handle("generate.text", Effect.fn("server.generate.text")(function* (request) {
|
|
8
|
-
return { data: { text: yield* (yield* Generate.Service).text(request.payload).pipe(Effect.mapError((error) => error._tag === "Generate.ModelSelectionError" ? new InvalidRequestError({ message: error.message }) : new ServiceUnavailableError({ message: error.message, service: error.service }))) } };
|
|
13
|
+
return { data: { text: yield* (yield* Generate.Service.pipe(Effect.provide(services))).text(request.payload).pipe(Effect.mapError((error) => error._tag === "Generate.ModelSelectionError" ? new InvalidRequestError({ message: error.message }) : new ServiceUnavailableError({ message: error.message, service: error.service }))) } };
|
|
9
14
|
}));
|
|
10
15
|
}));
|
package/dist/handlers/session.js
CHANGED
|
@@ -264,8 +264,7 @@ export const SessionHandler = HttpApiBuilder.group(Api, "server.session", (handl
|
|
|
264
264
|
yield* session.get(ctx.params.sessionID).pipe(Effect.catchTag("Session.NotFoundError", missingSession));
|
|
265
265
|
return session.log({ sessionID: ctx.params.sessionID, after: ctx.query.after, follow: ctx.query.follow }).pipe(Stream.orDie);
|
|
266
266
|
})).handle("session.interrupt", Effect.fn(function* (ctx) {
|
|
267
|
-
yield* session.interrupt(ctx.params.sessionID, { continue: ctx.query.continue });
|
|
268
|
-
return HttpApiSchema.NoContent.make();
|
|
267
|
+
return { interrupted: yield* session.interrupt(ctx.params.sessionID, { continue: ctx.query.continue }) };
|
|
269
268
|
})).handle("session.background", Effect.fn(function* (ctx) {
|
|
270
269
|
yield* session.background(ctx.params.sessionID).pipe(Effect.catchTag("Session.NotFoundError", missingSession));
|
|
271
270
|
return HttpApiSchema.NoContent.make();
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Workspace } from "@opencode-ai/core/workspace";
|
|
2
|
+
export declare const WorkspaceHandler: import("effect/Layer").Layer<import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.workspace">, never, Workspace.Service | (import("@opencode-ai/protocol/middleware/schema-error").SchemaErrorMiddleware | import("@opencode-ai/protocol/middleware/authorization").Authorization)>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Workspace } from "@opencode-ai/core/workspace";
|
|
2
|
+
import { UnknownError } from "@opencode-ai/protocol/errors";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
import { HttpApiBuilder } from "effect/unstable/httpapi";
|
|
5
|
+
import { Api } from "../api";
|
|
6
|
+
export const WorkspaceHandler = HttpApiBuilder.group(Api, "server.workspace", (handlers) => Effect.gen(function* () {
|
|
7
|
+
const workspace = yield* Workspace.Service;
|
|
8
|
+
return handlers.handle("workspace.destroy", (ctx) => workspace.destroy(ctx.params.workspaceID).pipe(Effect.mapError((error) => new UnknownError({
|
|
9
|
+
message: error._tag === "WorkspaceDriver.ProviderNotFound" ? `Workspace provider not found: ${error.provider}` : error.message ?? "Workspace provider failed to destroy the workspace"
|
|
10
|
+
}))));
|
|
11
|
+
}));
|
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">, never, import("@opencode-ai/protocol/middleware/schema-error").SchemaErrorMiddleware | import("@opencode-ai/protocol/middleware/authorization").Authorization | import("@opencode-ai/core/bus").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.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>>;
|
package/dist/handlers.js
CHANGED
|
@@ -29,4 +29,5 @@ import { VcsHandler } from "./handlers/vcs";
|
|
|
29
29
|
import { EventFeed } from "./event-feed";
|
|
30
30
|
import { MigrationHandler } from "./handlers/migration";
|
|
31
31
|
import { ConfigHandler } from "./handlers/config";
|
|
32
|
-
|
|
32
|
+
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);
|
package/dist/routes.js
CHANGED
|
@@ -62,15 +62,16 @@ const applicationServiceNodes = [
|
|
|
62
62
|
PtyEnvironment.node,
|
|
63
63
|
LocationServiceMap.node,
|
|
64
64
|
LocationActivity.node,
|
|
65
|
-
SessionRestart.node
|
|
66
|
-
|
|
65
|
+
SessionRestart.node,
|
|
66
|
+
Workspace.node
|
|
67
|
+
], applicationServices = LayerNode.group(applicationServiceNodes);
|
|
67
68
|
export function createRoutes(options = {}, serviceURLs = () => [], overrides = []) {
|
|
68
|
-
return makeRoutes(options.password ? ServerAuth.Config.configLayer({ password: Option.some(options.password) }) : ServerAuth.Config.layer, options, serviceURLs, overrides
|
|
69
|
+
return makeRoutes(options.password ? ServerAuth.Config.configLayer({ password: Option.some(options.password) }) : ServerAuth.Config.layer, options, serviceURLs, overrides);
|
|
69
70
|
}
|
|
70
71
|
export function createEmbeddedRoutes(options = {}, overrides = []) {
|
|
71
|
-
return makeRoutes(ServerAuth.Config.configLayer({ password: Option.none() }), options, () => [], overrides
|
|
72
|
+
return makeRoutes(ServerAuth.Config.configLayer({ password: Option.none() }), options, () => [], overrides);
|
|
72
73
|
}
|
|
73
|
-
function makeRoutes(auth, options, serviceURLs, overrides
|
|
74
|
+
function makeRoutes(auth, options, serviceURLs, overrides) {
|
|
74
75
|
const pluginRuntimeCell = PluginRuntime.makeCell(), replacements = [...[
|
|
75
76
|
[Database.node, Database.configured(options.database)],
|
|
76
77
|
[Bus.node, Bus.configured({ persist: options.events?.persist })],
|
|
@@ -103,11 +104,8 @@ function makeRoutes(auth, options, serviceURLs, overrides, embedded) {
|
|
|
103
104
|
], ...overrides];
|
|
104
105
|
return (options.simulation ? Layer.unwrap(Effect.gen(function* () {
|
|
105
106
|
const { simulationReplacements } = yield* Effect.promise(() => import("@opencode-ai/simulation/backend")), simulation = yield* simulationReplacements({ version: App.make(options.app).version });
|
|
106
|
-
return AppNodeBuilder.build(
|
|
107
|
-
|
|
108
|
-
...simulation
|
|
109
|
-
]);
|
|
110
|
-
})) : AppNodeBuilder.build(embedded ? embeddedApplicationServices : applicationServices, replacements)).pipe(Layer.flatMap((context) => {
|
|
107
|
+
return AppNodeBuilder.build(applicationServices, [...replacements, ...simulation]);
|
|
108
|
+
})) : AppNodeBuilder.build(applicationServices, replacements)).pipe(Layer.flatMap((context) => {
|
|
111
109
|
const services = Layer.succeedContext(context), requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, PermissionSaved.Service, Project.Service, WellKnown.Service)(context)), ServerInfo.layer(serviceURLs, options.app)), api = HttpApiBuilder.layer(Api, { openapiPath: "/openapi.json" }).pipe(Layer.provide(handlers.pipe(Layer.provide(services))), Layer.provide(formLocationLayer), Layer.provide(sessionLocationLayer), Layer.provide(layer), Layer.provide(authorizationLayer), Layer.provide(schemaErrorLayer), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer));
|
|
112
110
|
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
113
111
|
}));
|
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-dev-
|
|
4
|
+
"version": "0.0.0-dev-18122",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@effect/platform-node": "4.0.0-rc.111",
|
|
32
|
-
"@opencode-ai/core": "0.0.0-dev-
|
|
33
|
-
"@opencode-ai/protocol": "0.0.0-dev-
|
|
34
|
-
"@opencode-ai/schema": "0.0.0-dev-
|
|
35
|
-
"@opencode-ai/simulation": "0.0.0-dev-
|
|
36
|
-
"@opencode-ai/util": "0.0.0-dev-
|
|
32
|
+
"@opencode-ai/core": "0.0.0-dev-18122",
|
|
33
|
+
"@opencode-ai/protocol": "0.0.0-dev-18122",
|
|
34
|
+
"@opencode-ai/schema": "0.0.0-dev-18122",
|
|
35
|
+
"@opencode-ai/simulation": "0.0.0-dev-18122",
|
|
36
|
+
"@opencode-ai/util": "0.0.0-dev-18122",
|
|
37
37
|
"drizzle-orm": "1.0.0-rc.5-169397b",
|
|
38
38
|
"effect": "4.0.0-rc.111"
|
|
39
39
|
},
|