@opencode/server 2.0.0 → 2.0.2

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.
@@ -1,4 +1,21 @@
1
1
  import { Config } from "@opencode/core/config";
2
+ import { ShellSelect } from "@opencode/core/shell/select";
3
+ import { Effect } from "effect";
2
4
  import { HttpApiBuilder } from "effect/unstable/httpapi";
3
5
  import { Api } from "../api";
4
- export const ConfigHandler = HttpApiBuilder.group(Api, "server.config", (handlers) => handlers.handle("config.get", () => Config.Service.use((config) => config.entries())));
6
+ export const ConfigHandler = HttpApiBuilder.group(Api, "server.config", (handlers) => handlers.handle("config.get", () => Config.Service.use((config) => config.entries())).handle("config.preferences", Effect.fn(function* () {
7
+ const config = yield* Config.Service;
8
+ if (!config.preferences)
9
+ return yield* Effect.die(Error("Config preferences are unavailable"));
10
+ return yield* config.preferences().pipe(Effect.orDie);
11
+ })).handle("config.updatePreferences", Effect.fn(function* (ctx) {
12
+ const config = yield* Config.Service;
13
+ if (!config.updatePreferences)
14
+ return yield* Effect.die(Error("Config preference updates are unavailable"));
15
+ return yield* config.updatePreferences(ctx.payload).pipe(Effect.orDie);
16
+ })).handle("config.shells", Effect.fn(function* () {
17
+ const shell = yield* ShellSelect.Service;
18
+ if (!shell.list)
19
+ return yield* Effect.die(Error("Shell discovery is unavailable"));
20
+ return yield* shell.list();
21
+ })));
@@ -1,5 +1,6 @@
1
1
  import { FileSystem } from "@opencode/core/filesystem";
2
2
  import { RelativePath } from "@opencode/core/schema";
3
+ import { FileNotFoundError } from "@opencode/protocol/errors";
3
4
  import { Effect } from "effect";
4
5
  import { HttpServerResponse } from "effect/unstable/http";
5
6
  import { HttpApiBuilder } from "effect/unstable/httpapi";
@@ -9,7 +10,7 @@ export const FileSystemHandler = HttpApiBuilder.group(Api, "server.fs", (handler
9
10
  return handlers.handleRaw("fs.read", (ctx) => Effect.gen(function* () {
10
11
  const file = yield* (yield* FileSystem.Service).read({
11
12
  path: RelativePath.make(decodeURIComponent(new URL(ctx.request.url, "http://localhost").pathname.slice(13)))
12
- });
13
+ }).pipe(Effect.mapError((error) => new FileNotFoundError({ path: error.path, message: `File not found: ${error.path}` })));
13
14
  return HttpServerResponse.uint8Array(file.content, { contentType: file.mime });
14
15
  })).handle("fs.list", (ctx) => response(Effect.gen(function* () {
15
16
  return yield* (yield* FileSystem.Service).list(ctx.query);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/server",
4
- "version": "2.0.0",
4
+ "version": "2.0.2",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -30,17 +30,17 @@
30
30
  "dependencies": {
31
31
  "@effect/platform-node": "4.0.0-rc.112",
32
32
  "@effect/platform-node-shared": "4.0.0-rc.112",
33
- "@opencode/core": "2.0.0",
34
- "@opencode/protocol": "2.0.0",
35
- "@opencode/schema": "2.0.0",
36
- "@opencode/simulation": "2.0.0",
37
- "@opencode/util": "2.0.0",
33
+ "@opencode/core": "2.0.2",
34
+ "@opencode/protocol": "2.0.2",
35
+ "@opencode/schema": "2.0.2",
36
+ "@opencode/simulation": "2.0.2",
37
+ "@opencode/util": "2.0.2",
38
38
  "drizzle-orm": "1.0.0-rc.5-169397b",
39
39
  "effect": "4.0.0-rc.112"
40
40
  },
41
41
  "devDependencies": {
42
- "@opencode/client": "2.0.0",
43
- "@opencode/plugin": "2.0.0",
42
+ "@opencode/client": "2.0.2",
43
+ "@opencode/plugin": "2.0.2",
44
44
  "@tsconfig/bun": "1.0.9",
45
45
  "@types/bun": "1.4.0",
46
46
  "@typescript/native-preview": "7.0.0-dev.20251207.1"