@opencode/sdk 2.0.2 → 2.0.4
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/README.md +1 -1
- package/dist/effect/opencode.d.ts +8 -1
- package/dist/effect/opencode.js +6 -1
- package/dist/internal/host.d.ts +3 -1
- package/dist/internal/host.js +2 -0
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * as OpenCode from "./opencode";
|
|
2
2
|
import { type OpenCodeClient } from "@opencode/client/effect";
|
|
3
|
+
import type { Session } from "@opencode/core/session";
|
|
3
4
|
import type { Workspace } from "@opencode/core/workspace";
|
|
4
5
|
import { Context, Effect, Layer } from "effect";
|
|
5
6
|
import type { Config, Scope } from "effect";
|
|
@@ -11,7 +12,13 @@ export type EmbedOptions = EmbeddedHost.EmbedOptions;
|
|
|
11
12
|
export type InstanceOptions<R = never> = SdkInstances.Options<R>;
|
|
12
13
|
export type InstanceConfiguration = SdkInstances.Configuration;
|
|
13
14
|
export type Interface = Omit<OpenCodeClient, "plugin" | "workspace"> & {
|
|
14
|
-
readonly sessions: OpenCodeClient["session"]
|
|
15
|
+
readonly sessions: Omit<OpenCodeClient["session"], "create" | "get" | "move"> & {
|
|
16
|
+
readonly create: Session.Interface["create"];
|
|
17
|
+
readonly get: (input: {
|
|
18
|
+
readonly sessionID: Session.ID;
|
|
19
|
+
}) => ReturnType<Session.Interface["get"]>;
|
|
20
|
+
readonly move: Session.Interface["move"];
|
|
21
|
+
};
|
|
15
22
|
readonly events: OpenCodeClient["event"];
|
|
16
23
|
readonly workspace: {
|
|
17
24
|
readonly create: Workspace.Interface["create"];
|
package/dist/effect/opencode.js
CHANGED
|
@@ -7,7 +7,12 @@ export const create = Effect.fn("OpenCode.create")(function* (options = {}, embe
|
|
|
7
7
|
const host = yield* Effect.acquireRelease(EmbeddedHost.create(options, embed), (host) => Effect.promise(host.close)), httpClient = yield* HttpClient.HttpClient.pipe(Effect.provide(FetchHttpClient.layer)), client = yield* OpenCode.make({ baseUrl: "http://opencode.local" }).pipe(Effect.provideService(HttpClient.HttpClient, HttpClient.transformResponse(httpClient, Effect.provideService(FetchHttpClient.Fetch, host.fetch))));
|
|
8
8
|
return {
|
|
9
9
|
...client,
|
|
10
|
-
sessions:
|
|
10
|
+
sessions: {
|
|
11
|
+
...client.session,
|
|
12
|
+
create: host.sessions.create,
|
|
13
|
+
get: (input) => host.sessions.get(input.sessionID),
|
|
14
|
+
move: host.sessions.move
|
|
15
|
+
},
|
|
11
16
|
events: client.event,
|
|
12
17
|
workspace: {
|
|
13
18
|
create: host.workspace.create,
|
package/dist/internal/host.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * as EmbeddedHost from "./host";
|
|
2
2
|
import { SdkPlugins } from "@opencode/core/plugin/sdk";
|
|
3
3
|
import { SessionRestart } from "@opencode/core/session/execution/restart";
|
|
4
|
+
import { Session } from "@opencode/core/session";
|
|
4
5
|
import { Workspace } from "@opencode/core/workspace";
|
|
5
6
|
import { WorkspaceDriver } from "@opencode/core/workspace/driver";
|
|
6
7
|
import type { ServerOptions } from "@opencode/server/options";
|
|
@@ -19,11 +20,12 @@ export interface EmbedOptions {
|
|
|
19
20
|
readonly overrides?: LayerNode.Replacements;
|
|
20
21
|
}
|
|
21
22
|
export declare const create: <R = never>(options?: CreateOptions<R> | undefined, embed?: EmbedOptions | undefined) => Effect.Effect<{
|
|
22
|
-
runtime: ManagedRuntime.ManagedRuntime<import("effect/unstable/http/HttpClient").HttpClient | import("@opencode/util/global").Service | import("@opencode/core/database/database").Service | import("@opencode/core/project").Service | import("@opencode/core/bus").Service | import("@opencode/core/persistent-pty/index").Service | import("@opencode/core/credential").Service | import("@opencode/core/wellknown").Service | Workspace.Service | import("@opencode/core/permission/saved").Service | SdkPlugins.Service | import("@opencode/core/plugin/update").Service | import("@opencode/core/
|
|
23
|
+
runtime: ManagedRuntime.ManagedRuntime<import("effect/unstable/http/HttpClient").HttpClient | import("@opencode/util/global").Service | import("@opencode/core/database/database").Service | import("@opencode/core/project").Service | import("@opencode/core/bus").Service | import("@opencode/core/persistent-pty/index").Service | import("@opencode/core/credential").Service | import("@opencode/core/wellknown").Service | Workspace.Service | import("@opencode/core/permission/saved").Service | SdkPlugins.Service | import("@opencode/core/plugin/update").Service | Session.Service | import("@opencode/core/job").Service | import("@opencode/core/instance").Service | import("@opencode/core/worktree").Service | import("@opencode/core/location-service-map").Service | SessionRestart.Service | import("@opencode/core/pty/ticket").Service | import("@opencode/core/session/transfer").Service | import("@opencode/core/location-activity").Service | import("@opencode/server/pty-environment").Service | HttpRouter.HttpRouter, Error | import("@opencode/core/persistent-pty/index").UnavailableError>;
|
|
23
24
|
fetch: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) & {
|
|
24
25
|
preconnect: () => undefined;
|
|
25
26
|
};
|
|
26
27
|
plugins: SdkPlugins.Interface;
|
|
28
|
+
sessions: Session.Interface;
|
|
27
29
|
workspace: Workspace.Interface;
|
|
28
30
|
close: () => Promise<void>;
|
|
29
31
|
}, Error, R>;
|
package/dist/internal/host.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * as EmbeddedHost from "./host";
|
|
2
2
|
import { SdkPlugins } from "@opencode/core/plugin/sdk";
|
|
3
3
|
import { SessionRestart } from "@opencode/core/session/execution/restart";
|
|
4
|
+
import { Session } from "@opencode/core/session";
|
|
4
5
|
import { Workspace } from "@opencode/core/workspace";
|
|
5
6
|
import { WorkspaceDriver } from "@opencode/core/workspace/driver";
|
|
6
7
|
import { createEmbeddedRoutes } from "@opencode/server/routes";
|
|
@@ -23,6 +24,7 @@ export const create = Effect.fn("EmbeddedHost.create")(function* (options = {},
|
|
|
23
24
|
runtime,
|
|
24
25
|
fetch: transport.fetch,
|
|
25
26
|
plugins: Context.get(services, SdkPlugins.Service),
|
|
27
|
+
sessions: Context.get(services, Session.Service),
|
|
26
28
|
workspace: Context.get(services, Workspace.Service),
|
|
27
29
|
close: transport.close
|
|
28
30
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"name": "@opencode/sdk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"verify:package": "bun run script/verify-package.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@opencode/client": "2.0.
|
|
44
|
-
"@opencode/core": "2.0.
|
|
45
|
-
"@opencode/plugin": "2.0.
|
|
46
|
-
"@opencode/schema": "2.0.
|
|
47
|
-
"@opencode/server": "2.0.
|
|
48
|
-
"@opencode/util": "2.0.
|
|
43
|
+
"@opencode/client": "2.0.4",
|
|
44
|
+
"@opencode/core": "2.0.4",
|
|
45
|
+
"@opencode/plugin": "2.0.4",
|
|
46
|
+
"@opencode/schema": "2.0.4",
|
|
47
|
+
"@opencode/server": "2.0.4",
|
|
48
|
+
"@opencode/util": "2.0.4",
|
|
49
49
|
"effect": "4.0.0-rc.112"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@opencode/ai": "2.0.
|
|
53
|
-
"@opencode/httpapi-codegen": "2.0.
|
|
54
|
-
"@opencode/protocol": "2.0.
|
|
52
|
+
"@opencode/ai": "2.0.4",
|
|
53
|
+
"@opencode/httpapi-codegen": "2.0.4",
|
|
54
|
+
"@opencode/protocol": "2.0.4",
|
|
55
55
|
"@tsconfig/bun": "1.0.9",
|
|
56
56
|
"@types/bun": "1.4.0",
|
|
57
57
|
"@typescript/native-preview": "7.0.0-dev.20251207.1"
|