@opencode/sdk 2.1.3 → 2.2.0

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,6 +1,6 @@
1
1
  import {
2
2
  create4
3
- } from "./tool-2pwt3b7h.js";
3
+ } from "./tool-1yk873fy.js";
4
4
  import {
5
5
  __export
6
6
  } from "./tool-9rqn6x4v.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  create5
3
- } from "./tool-t77www6f.js";
3
+ } from "./tool-k957975v.js";
4
4
  import {
5
5
  __export
6
6
  } from "./tool-9rqn6x4v.js";
@@ -13,9 +13,8 @@ __export(exports_instances, {
13
13
  import { Instance } from "@opencode/core/instance";
14
14
  import { LocationServiceMap } from "@opencode/core/location-service-map";
15
15
  import { Plugin } from "@opencode/core/plugin";
16
- import { Location } from "@opencode/schema/location";
17
16
  import { makeGlobalNode } from "@opencode/util/effect/app-node";
18
- import { Context, Duration, Effect, Layer, LayerMap } from "effect";
17
+ import { Context, Duration, Effect, Layer, LayerMap, RcMap } from "effect";
19
18
  function provide2(options, context) {
20
19
  return {
21
20
  key: options.key,
@@ -40,7 +39,7 @@ function layer3(options, replacements) {
40
39
  const provide = (session) => Effect.provide(instances.get(key(session)));
41
40
  const instances = yield* LayerMap.make((input) => Layer.unwrap(Effect.gen(function* () {
42
41
  const configuration = yield* options.configure(input.key).pipe(Effect.orDie);
43
- return Instance.layer(Location.Ref.make({ directory: input.directory, workspaceID: input.workspaceID }), {
42
+ return Instance.layer(input, {
44
43
  plugins: configuration.plugins,
45
44
  replacements: [
46
45
  ...replacements(),
@@ -55,7 +54,7 @@ function layer3(options, replacements) {
55
54
  yield* Effect.die(new Error(`Instance plugin setup failed: ${failed.map((plugin) => plugin.id).join(", ")}`));
56
55
  }).pipe(Effect.provide(context))));
57
56
  })).pipe(Layer.tapCause(() => instances.invalidate(input).pipe(Effect.forkIn(scope, { startImmediately: true }), Effect.asVoid))), { idleTimeToLive: Duration.infinity });
58
- return Instance.Service.of({ provide });
57
+ return Instance.Service.of({ provide, live: (session) => RcMap.has(instances.rcMap, key(session)) });
59
58
  }));
60
59
  }
61
60
 
@@ -2,7 +2,7 @@ import {
2
2
  __export
3
3
  } from "./tool-9rqn6x4v.js";
4
4
 
5
- // src/effect/tool.ts
5
+ // src/tool.ts
6
6
  var exports_tool = {};
7
7
  __export(exports_tool, {
8
8
  Error: () => Error2,
@@ -2,7 +2,7 @@ import {
2
2
  __export
3
3
  } from "./tool-9rqn6x4v.js";
4
4
 
5
- // src/tool.ts
5
+ // src/effect/tool.ts
6
6
  var exports_tool2 = {};
7
7
  __export(exports_tool2, {
8
8
  Error: () => Error3,
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  layer4,
3
3
  context2
4
- } from "./tool-ya9awdj2.js";
4
+ } from "./tool-t7drb6e9.js";
5
5
  import {
6
6
  make3
7
7
  } from "./tool-f8tdk121.js";
8
8
  import {
9
9
  provide2,
10
10
  node2
11
- } from "./tool-52ftzhtt.js";
11
+ } from "./tool-5k7t7h61.js";
12
12
  import {
13
13
  __export
14
14
  } from "./tool-9rqn6x4v.js";
@@ -16,20 +16,17 @@ var levelNames = new Map([
16
16
  [levels.error, "error"],
17
17
  [levels.fatal, "fatal"]
18
18
  ]);
19
- function normalizeLevel(level) {
20
- return levelNames.get(level);
21
- }
22
19
  function layer4(log) {
23
20
  const logger = Logger.make((options) => {
24
21
  if (!log)
25
22
  return;
26
- const level = normalizeLevel(options.logLevel);
23
+ const level = levelNames.get(options.logLevel);
27
24
  if (!level)
28
25
  return;
29
26
  const entry = Logger.formatStructured.log(options);
30
27
  const values = Array.isArray(entry.message) ? entry.message : [entry.message];
31
28
  const [message, ...data] = values;
32
- const details = data.length === 1 && !Array.isArray(data[0]) ? data[0] : undefined;
29
+ const details = data.length === 1 && typeof data[0] === "object" && data[0] !== null && !Array.isArray(data[0]) ? data[0] : undefined;
33
30
  const { cause: detailCause, ...detailAttributes } = details ?? {};
34
31
  const attributes = {
35
32
  ...entry.annotations,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  create5
3
- } from "./tool-t77www6f.js";
3
+ } from "./tool-k957975v.js";
4
4
  import {
5
5
  __export
6
6
  } from "./tool-9rqn6x4v.js";
@@ -1,13 +1,13 @@
1
- import"../chunks/tool-ya9awdj2.js";
1
+ import"../chunks/tool-t7drb6e9.js";
2
2
  import"../chunks/tool-f8tdk121.js";
3
- import"../chunks/tool-52ftzhtt.js";
4
- import"../chunks/tool-t77www6f.js";
3
+ import"../chunks/tool-5k7t7h61.js";
4
+ import"../chunks/tool-k957975v.js";
5
5
  import {
6
6
  exports_opencode
7
- } from "../chunks/tool-hxgb2mew.js";
7
+ } from "../chunks/tool-xhrham4d.js";
8
8
  import {
9
- exports_tool
10
- } from "../chunks/tool-v20ebq3t.js";
9
+ exports_tool2
10
+ } from "../chunks/tool-heqzazck.js";
11
11
  import {
12
12
  Agent2,
13
13
  Command2,
@@ -72,7 +72,7 @@ export {
72
72
  SessionInbox2 as SessionInbox,
73
73
  SessionMessage2 as SessionMessage,
74
74
  Skill2 as Skill,
75
- exports_tool as Tool,
75
+ exports_tool2 as Tool,
76
76
  WebSearch2 as WebSearch,
77
77
  Workspace2 as Workspace,
78
78
  WorkspaceDriver,
@@ -3,11 +3,11 @@ import {
3
3
  Service2,
4
4
  layer2,
5
5
  exports_opencode
6
- } from "../chunks/tool-hxgb2mew.js";
7
- import"../chunks/tool-t77www6f.js";
6
+ } from "../chunks/tool-xhrham4d.js";
7
+ import"../chunks/tool-k957975v.js";
8
+ import"../chunks/tool-5k7t7h61.js";
8
9
  import"../chunks/tool-f8tdk121.js";
9
- import"../chunks/tool-52ftzhtt.js";
10
- import"../chunks/tool-ya9awdj2.js";
10
+ import"../chunks/tool-t7drb6e9.js";
11
11
  export {
12
12
  exports_opencode as OpenCode,
13
13
  Service2 as Service,
@@ -1,8 +1,8 @@
1
1
  import {
2
- RegistrationError2,
3
- Error2
4
- } from "../chunks/tool-v20ebq3t.js";
2
+ RegistrationError3,
3
+ Error3
4
+ } from "../chunks/tool-heqzazck.js";
5
5
  export {
6
- Error2 as Error,
7
- RegistrationError2 as RegistrationError
6
+ Error3 as Error,
7
+ RegistrationError3 as RegistrationError
8
8
  };
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  make2
3
3
  } from "../chunks/tool-v4tj0tsx.js";
4
- import"../chunks/tool-ya9awdj2.js";
4
+ import"../chunks/tool-t7drb6e9.js";
5
5
  import"../chunks/tool-f8tdk121.js";
6
- import"../chunks/tool-52ftzhtt.js";
7
- import"../chunks/tool-t77www6f.js";
6
+ import"../chunks/tool-5k7t7h61.js";
7
+ import"../chunks/tool-k957975v.js";
8
8
  import {
9
9
  create2,
10
10
  Service2
11
- } from "../chunks/tool-hxgb2mew.js";
11
+ } from "../chunks/tool-xhrham4d.js";
12
12
  import {
13
13
  __export
14
14
  } from "../chunks/tool-9rqn6x4v.js";
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import"./chunks/tool-ya9awdj2.js";
1
+ import"./chunks/tool-t7drb6e9.js";
2
2
  import"./chunks/tool-f8tdk121.js";
3
- import"./chunks/tool-52ftzhtt.js";
4
- import"./chunks/tool-t77www6f.js";
5
- import"./chunks/tool-2pwt3b7h.js";
3
+ import"./chunks/tool-5k7t7h61.js";
4
+ import"./chunks/tool-k957975v.js";
5
+ import"./chunks/tool-1yk873fy.js";
6
6
  import {
7
7
  exports_opencode2
8
- } from "./chunks/tool-fsfpnzey.js";
8
+ } from "./chunks/tool-1ekv0a18.js";
9
9
  import {
10
- exports_tool2
11
- } from "./chunks/tool-xk8fc419.js";
10
+ exports_tool
11
+ } from "./chunks/tool-ama421zy.js";
12
12
  import {
13
13
  Agent2,
14
14
  Command2,
@@ -68,7 +68,7 @@ export {
68
68
  SessionInbox2 as SessionInbox,
69
69
  SessionMessage2 as SessionMessage,
70
70
  Skill2 as Skill,
71
- exports_tool2 as Tool,
71
+ exports_tool as Tool,
72
72
  WebSearch2 as WebSearch,
73
73
  Workspace2 as Workspace,
74
74
  Worktree2 as Worktree
@@ -22,7 +22,7 @@ export interface EmbedOptions {
22
22
  readonly overrides?: LayerNode.Replacements;
23
23
  }
24
24
  export declare const create: <R = never>(options?: CreateOptions<R> | undefined, embed?: EmbedOptions | undefined) => Effect.Effect<{
25
- runtime: ManagedRuntime.ManagedRuntime<import("effect/http/HttpClient").HttpClient | HttpRouter.HttpRouter | 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 | import("@opencode/core/instance").Service | import("@opencode/core/job").Service | Session.Service | import("@opencode/core/worktree").Service | import("@opencode/core/plugin/update").Service | import("@opencode/core/location-service-map").Service | SdkPlugins.Service | SessionRestart.Service | import("@opencode/core/pty/ticket").Service | import("@opencode/core/session/transfer").Service | import("@opencode/core/location-activity").Service | import("@opencode/server/pairing").Service | import("@opencode/server/pty-environment").Service, Error | import("@opencode/core/persistent-pty/index").UnavailableError>;
25
+ runtime: ManagedRuntime.ManagedRuntime<import("effect/http/HttpClient").HttpClient | HttpRouter.HttpRouter | import("@opencode/util/global").Service | import("@opencode/core/database/database").Service | import("@opencode/util/fs-util").FSUtil.Service | import("@opencode/core/project").Service | import("@opencode/core/credential").Service | import("@opencode/core/wellknown").Service | import("@opencode/core/bus").Service | import("@opencode/core/persistent-pty/index").Service | Workspace.Service | import("@opencode/core/permission/saved").Service | import("@opencode/core/instance").Service | import("@opencode/core/session/instruction-entry").Service | import("@opencode/core/job").Service | Session.Service | import("@opencode/core/worktree").Service | import("@opencode/core/plugin/update").Service | import("@opencode/core/location-service-map").Service | SdkPlugins.Service | SessionRestart.Service | import("@opencode/core/pty/ticket").Service | import("@opencode/core/session/transfer").Service | import("@opencode/core/location-activity").Service | import("@opencode/core/filesystem/file-watch").Service | import("@opencode/server/pairing").Service, Error | import("@opencode/core/persistent-pty/index").UnavailableError>;
26
26
  fetch: ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) & {
27
27
  preconnect: () => undefined;
28
28
  };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  create5,
3
3
  exports_host
4
- } from "../chunks/tool-t77www6f.js";
4
+ } from "../chunks/tool-k957975v.js";
5
+ import"../chunks/tool-5k7t7h61.js";
5
6
  import"../chunks/tool-f8tdk121.js";
6
- import"../chunks/tool-52ftzhtt.js";
7
- import"../chunks/tool-ya9awdj2.js";
7
+ import"../chunks/tool-t7drb6e9.js";
8
8
  export {
9
9
  exports_host as EmbeddedHost,
10
10
  create5 as create
@@ -3,7 +3,7 @@ import {
3
3
  node2,
4
4
  layer3,
5
5
  exports_instances
6
- } from "../chunks/tool-52ftzhtt.js";
6
+ } from "../chunks/tool-5k7t7h61.js";
7
7
  export {
8
8
  exports_instances as SdkInstances,
9
9
  layer3 as layer,
package/dist/logging.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  layer4,
3
3
  context2
4
- } from "./chunks/tool-ya9awdj2.js";
4
+ } from "./chunks/tool-t7drb6e9.js";
5
5
  export {
6
6
  context2 as context,
7
7
  layer4 as layer
package/dist/opencode.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  create3
3
- } from "./chunks/tool-fsfpnzey.js";
4
- import"./chunks/tool-2pwt3b7h.js";
5
- import"./chunks/tool-t77www6f.js";
3
+ } from "./chunks/tool-1ekv0a18.js";
4
+ import"./chunks/tool-1yk873fy.js";
5
+ import"./chunks/tool-k957975v.js";
6
+ import"./chunks/tool-5k7t7h61.js";
6
7
  import"./chunks/tool-f8tdk121.js";
7
- import"./chunks/tool-52ftzhtt.js";
8
- import"./chunks/tool-ya9awdj2.js";
8
+ import"./chunks/tool-t7drb6e9.js";
9
9
  export {
10
10
  create3 as create
11
11
  };
package/dist/promise.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  create4,
3
3
  exports_promise
4
- } from "./chunks/tool-2pwt3b7h.js";
5
- import"./chunks/tool-t77www6f.js";
4
+ } from "./chunks/tool-1yk873fy.js";
5
+ import"./chunks/tool-k957975v.js";
6
+ import"./chunks/tool-5k7t7h61.js";
6
7
  import"./chunks/tool-f8tdk121.js";
7
- import"./chunks/tool-52ftzhtt.js";
8
- import"./chunks/tool-ya9awdj2.js";
8
+ import"./chunks/tool-t7drb6e9.js";
9
9
  export {
10
10
  exports_promise as PromiseSdk,
11
11
  create4 as create
package/dist/tool.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
- RegistrationError3,
3
- Error3
4
- } from "./chunks/tool-xk8fc419.js";
2
+ RegistrationError2,
3
+ Error2
4
+ } from "./chunks/tool-ama421zy.js";
5
5
  export {
6
- Error3 as Error,
7
- RegistrationError3 as RegistrationError
6
+ Error2 as Error,
7
+ RegistrationError2 as RegistrationError
8
8
  };
package/dist/workerd.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  make2
3
3
  } from "./chunks/tool-v4tj0tsx.js";
4
- import"./chunks/tool-ya9awdj2.js";
4
+ import"./chunks/tool-t7drb6e9.js";
5
5
  import"./chunks/tool-f8tdk121.js";
6
- import"./chunks/tool-52ftzhtt.js";
7
- import"./chunks/tool-t77www6f.js";
6
+ import"./chunks/tool-5k7t7h61.js";
7
+ import"./chunks/tool-k957975v.js";
8
8
  import {
9
9
  create4
10
- } from "./chunks/tool-2pwt3b7h.js";
10
+ } from "./chunks/tool-1yk873fy.js";
11
11
  import {
12
12
  __export
13
13
  } from "./chunks/tool-9rqn6x4v.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "2.1.3",
3
+ "version": "2.2.0",
4
4
  "name": "@opencode/sdk",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -35,25 +35,27 @@
35
35
  },
36
36
  "scripts": {
37
37
  "build": "bun run script/build.ts",
38
+ "pack": "bun run script/pack.ts",
38
39
  "test": "bun test --timeout 5000",
39
- "typecheck": "tsc -b",
40
+ "typecheck": "bun check --no-script -b",
41
+ "typecheck:tsc": "tsc -b",
40
42
  "verify:package": "bun run script/verify-package.ts"
41
43
  },
42
44
  "dependencies": {
43
- "@opencode/client": "2.1.3",
44
- "@opencode/core": "2.1.3",
45
- "@opencode/plugin": "2.1.3",
46
- "@opencode/schema": "2.1.3",
47
- "@opencode/server": "2.1.3",
48
- "@opencode/util": "2.1.3",
45
+ "@opencode/client": "2.2.0",
46
+ "@opencode/core": "2.2.0",
47
+ "@opencode/plugin": "2.2.0",
48
+ "@opencode/schema": "2.2.0",
49
+ "@opencode/server": "2.2.0",
50
+ "@opencode/util": "2.2.0",
49
51
  "effect": "4.0.1"
50
52
  },
51
53
  "devDependencies": {
52
- "@opencode/ai": "2.1.3",
53
- "@opencode/httpapi-codegen": "2.1.3",
54
- "@opencode/protocol": "2.1.3",
54
+ "@opencode/ai": "2.2.0",
55
+ "@opencode/httpapi-codegen": "2.2.0",
56
+ "@opencode/protocol": "2.2.0",
55
57
  "@tsconfig/bun": "1.0.9",
56
58
  "@types/bun": "1.4.3",
57
- "@typescript/native": "npm:typescript@7.0.2"
59
+ "@typescript/native": "npm:typescript@7.1.0-beta"
58
60
  }
59
61
  }