@opencode/plugin 2.0.11 → 2.0.13
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/promise/adapter.js +12 -11
- package/dist/promise/tool.d.ts +1 -0
- package/package.json +8 -8
package/dist/promise/adapter.js
CHANGED
|
@@ -171,17 +171,17 @@ export function fromPromise(plugin) {
|
|
|
171
171
|
const VcsEndpoints = ClientApi.groups["server.vcs"].endpoints;
|
|
172
172
|
const WebSearchEndpoints = ClientApi.groups["server.websearch"].endpoints;
|
|
173
173
|
const WorktreeEndpoints = ClientApi.groups["server.worktree"].endpoints;
|
|
174
|
-
const
|
|
174
|
+
const runtime = yield* Effect.context();
|
|
175
175
|
const streams = yield* makeStreams();
|
|
176
176
|
// Run a hook registration on the plugin scope and resolve once it is registered.
|
|
177
|
-
const register = (effect) => Effect.runPromiseWith(
|
|
178
|
-
dispose: () => Effect.runPromiseWith(
|
|
177
|
+
const register = (effect) => Effect.runPromiseWith(runtime)(effect).then((registration) => ({
|
|
178
|
+
dispose: () => Effect.runPromiseWith(runtime)(registration.dispose),
|
|
179
179
|
}));
|
|
180
|
-
const run = (effect) => Effect.runPromiseWith(
|
|
181
|
-
const promiseExecutor = (execute) => (input, context) =>
|
|
180
|
+
const run = (effect) => Effect.runPromiseWith(runtime)(effect);
|
|
181
|
+
const promiseExecutor = (execute) => (input, context) => Effect.runPromiseWith(runtime)(execute(input, {
|
|
182
182
|
...context,
|
|
183
183
|
progress: (update) => Effect.promise(() => context.progress(update)),
|
|
184
|
-
}));
|
|
184
|
+
}), { signal: context.signal });
|
|
185
185
|
const adaptApiMethod = (endpoint, method) => {
|
|
186
186
|
const compiled = compileEndpoint(endpoint);
|
|
187
187
|
return ((input) => Effect.gen(function* () {
|
|
@@ -192,7 +192,7 @@ export function fromPromise(plugin) {
|
|
|
192
192
|
if (compiled.noContent)
|
|
193
193
|
return undefined;
|
|
194
194
|
return yield* compiled.encode(result);
|
|
195
|
-
}).pipe(Effect.runPromiseWith(
|
|
195
|
+
}).pipe(Effect.runPromiseWith(runtime)));
|
|
196
196
|
};
|
|
197
197
|
const transform = (domain) => (callback) => register(domain.transform((editor) => {
|
|
198
198
|
callback(editor);
|
|
@@ -292,8 +292,8 @@ export function fromPromise(plugin) {
|
|
|
292
292
|
}))),
|
|
293
293
|
reload: () => run(host.integration.reload()),
|
|
294
294
|
connection: {
|
|
295
|
-
active: (id) => Effect.runPromiseWith(
|
|
296
|
-
resolve: (connection) => Effect.runPromiseWith(
|
|
295
|
+
active: (id) => Effect.runPromiseWith(runtime)(host.integration.connection.active(id)),
|
|
296
|
+
resolve: (connection) => Effect.runPromiseWith(runtime)(host.integration.connection.resolve(connection)),
|
|
297
297
|
},
|
|
298
298
|
},
|
|
299
299
|
mcp: {
|
|
@@ -441,7 +441,8 @@ export function fromPromise(plugin) {
|
|
|
441
441
|
function attempt(evaluate) {
|
|
442
442
|
return Effect.tryPromise({ try: evaluate, catch: (cause) => cause });
|
|
443
443
|
}
|
|
444
|
-
const executePromiseTool = (tool, input, context) => Effect.promise(() => tool.execute(input, {
|
|
444
|
+
const executePromiseTool = (tool, input, context) => Effect.promise((signal) => tool.execute(input, {
|
|
445
445
|
...context,
|
|
446
|
-
|
|
446
|
+
signal,
|
|
447
|
+
progress: (update) => Effect.runPromise(context.progress(update), { signal }),
|
|
447
448
|
}));
|
package/dist/promise/tool.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { SessionMessage } from "@opencode/schema/session-message";
|
|
|
7
7
|
import type { Types } from "effect";
|
|
8
8
|
import type { Hooks, Transform } from "./registration.js";
|
|
9
9
|
export interface ToolContext extends Omit<Tool.Context, "progress"> {
|
|
10
|
+
readonly signal: AbortSignal;
|
|
10
11
|
readonly progress: (update: Tool.Metadata) => Promise<void>;
|
|
11
12
|
}
|
|
12
13
|
export type Info<Input extends Tool.ValueSchema<any> = Tool.ValueSchema<any>, Output extends Tool.ValueSchema<any> | undefined = Tool.ValueSchema<any> | undefined> = Omit<Tool.Info<Input, Output>, "execute"> & {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@opencode/plugin",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.13",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ai-sdk/provider": "3.0.8",
|
|
46
|
-
"@opencode/ai": "2.0.
|
|
47
|
-
"@opencode/client": "2.0.
|
|
48
|
-
"@opencode/protocol": "2.0.
|
|
49
|
-
"@opencode/schema": "2.0.
|
|
50
|
-
"@opencode/util": "2.0.
|
|
46
|
+
"@opencode/ai": "2.0.13",
|
|
47
|
+
"@opencode/client": "2.0.13",
|
|
48
|
+
"@opencode/protocol": "2.0.13",
|
|
49
|
+
"@opencode/schema": "2.0.13",
|
|
50
|
+
"@opencode/util": "2.0.13",
|
|
51
51
|
"@standard-schema/spec": "1.1.0",
|
|
52
52
|
"effect": "4.0.0-rc.112",
|
|
53
53
|
"zod": "4.1.8"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@opencode/theme": "2.0.
|
|
56
|
+
"@opencode/theme": "2.0.13",
|
|
57
57
|
"@opentui/core": ">=0.5.10",
|
|
58
58
|
"@opentui/solid": ">=0.5.10",
|
|
59
59
|
"solid-js": ">=1.9.0"
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@opencode/theme": "2.0.
|
|
76
|
+
"@opencode/theme": "2.0.13",
|
|
77
77
|
"@opentui/core": "0.5.10",
|
|
78
78
|
"@opentui/solid": "0.5.10",
|
|
79
79
|
"@tsconfig/bun": "1.0.9",
|