@opencode/plugin 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/dist/effect/model.d.ts +29 -0
- package/dist/effect/permission.d.ts +1 -1
- package/dist/effect/plugin.d.ts +4 -2
- package/dist/effect/provider.d.ts +34 -0
- package/dist/effect/provider.js +0 -0
- package/dist/effect/session.d.ts +14 -1
- package/dist/promise/adapter.js +17 -15
- package/dist/promise/model.d.ts +29 -0
- package/dist/promise/model.js +0 -0
- package/dist/promise/permission.d.ts +1 -1
- package/dist/promise/plugin.d.ts +4 -2
- package/dist/promise/provider.d.ts +34 -0
- package/dist/promise/provider.js +0 -0
- package/dist/promise/session.d.ts +14 -1
- package/dist/source.bun.js +11 -1
- package/dist/source.node.js +12 -2
- package/dist/source.package.d.ts +1 -0
- package/dist/source.package.js +15 -0
- package/dist/tui/context.d.ts +4 -3
- package/package.json +8 -8
- package/dist/effect/catalog.d.ts +0 -33
- package/dist/effect/catalog.js +0 -2
- package/dist/promise/catalog.d.ts +0 -33
- /package/dist/{promise/catalog.js → effect/model.js} +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ModelApi } from "@opencode/client/effect/api";
|
|
2
|
+
import type { Model } from "@opencode/schema/model";
|
|
3
|
+
import type { Effect, Types } from "effect";
|
|
4
|
+
import type { ProviderRecord } from "./provider.js";
|
|
5
|
+
import type { Transform } from "./registration.js";
|
|
6
|
+
export interface ModelEditor {
|
|
7
|
+
/** Candidates from available providers, including models disabled by earlier transforms. */
|
|
8
|
+
list(providerID?: string): readonly Types.DeepMutable<Model.Info>[];
|
|
9
|
+
get(providerID: string, modelID: string): Types.DeepMutable<Model.Info> | undefined;
|
|
10
|
+
/** Edits raw model overrides; cannot create an unavailable provider. */
|
|
11
|
+
update(providerID: string, modelID: string, update: (model: Types.DeepMutable<Model.Info>) => void): void;
|
|
12
|
+
remove(providerID: string, modelID: string): void;
|
|
13
|
+
readonly default: {
|
|
14
|
+
get(): {
|
|
15
|
+
providerID: string;
|
|
16
|
+
modelID: string;
|
|
17
|
+
} | undefined;
|
|
18
|
+
set(providerID: string, modelID: string): void;
|
|
19
|
+
};
|
|
20
|
+
/** Immutable provider inputs, including inactive templates, before model transforms. */
|
|
21
|
+
readonly provider: {
|
|
22
|
+
list(): readonly ProviderRecord[];
|
|
23
|
+
get(providerID: string): ProviderRecord | undefined;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface ModelDomain extends ModelApi<unknown> {
|
|
27
|
+
readonly transform: Transform<ModelEditor>;
|
|
28
|
+
readonly reload: () => Effect.Effect<void>;
|
|
29
|
+
}
|
|
@@ -16,6 +16,6 @@ export interface PermissionEvaluation {
|
|
|
16
16
|
export interface PermissionHooks {
|
|
17
17
|
readonly evaluate: PermissionEvaluation;
|
|
18
18
|
}
|
|
19
|
-
export type PermissionDomain = Pick<PermissionApi<unknown>, "list" | "get" | "reply"
|
|
19
|
+
export type PermissionDomain = Pick<PermissionApi<unknown>, "list" | "get" | "reply"> & {
|
|
20
20
|
readonly hook: Hooks<PermissionHooks>;
|
|
21
21
|
};
|
package/dist/effect/plugin.d.ts
CHANGED
|
@@ -5,12 +5,13 @@ import type { PluginOptions } from "../options.js";
|
|
|
5
5
|
import type { App } from "../app.js";
|
|
6
6
|
import type { AgentDomain } from "./agent.js";
|
|
7
7
|
import type { AISDKDomain } from "./aisdk.js";
|
|
8
|
-
import type { CatalogDomain } from "./catalog.js";
|
|
9
8
|
import type { CommandDomain } from "./command.js";
|
|
10
9
|
import type { EventDomain } from "./event.js";
|
|
11
10
|
import type { IntegrationDomain } from "./integration.js";
|
|
12
11
|
import type { MCPDomain } from "./mcp.js";
|
|
12
|
+
import type { ModelDomain } from "./model.js";
|
|
13
13
|
import type { PermissionDomain } from "./permission.js";
|
|
14
|
+
import type { ProviderDomain } from "./provider.js";
|
|
14
15
|
import type { ReferenceDomain } from "./reference.js";
|
|
15
16
|
import type { RpcDomain } from "./rpc.js";
|
|
16
17
|
import type { SessionDomain } from "./session.js";
|
|
@@ -27,7 +28,6 @@ export interface Context {
|
|
|
27
28
|
readonly options: PluginOptions;
|
|
28
29
|
readonly agent: AgentDomain;
|
|
29
30
|
readonly aisdk: AISDKDomain;
|
|
30
|
-
readonly catalog: CatalogDomain;
|
|
31
31
|
readonly command: CommandDomain;
|
|
32
32
|
readonly event: EventDomain;
|
|
33
33
|
readonly experimental: {
|
|
@@ -35,9 +35,11 @@ export interface Context {
|
|
|
35
35
|
};
|
|
36
36
|
readonly integration: IntegrationDomain;
|
|
37
37
|
readonly mcp: MCPDomain;
|
|
38
|
+
readonly model: ModelDomain;
|
|
38
39
|
readonly generate: GenerateApi<unknown>;
|
|
39
40
|
readonly permission: PermissionDomain;
|
|
40
41
|
readonly plugin: Pick<PluginApi<unknown>, "list">;
|
|
42
|
+
readonly provider: ProviderDomain;
|
|
41
43
|
readonly reference: ReferenceDomain;
|
|
42
44
|
readonly rpc: RpcDomain;
|
|
43
45
|
readonly session: SessionDomain;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ProviderApi } from "@opencode/client/effect/api";
|
|
2
|
+
import type { Model } from "@opencode/schema/model";
|
|
3
|
+
import type { Provider } from "@opencode/schema/provider";
|
|
4
|
+
import type { ConnectionInfo } from "@opencode/client";
|
|
5
|
+
import type { Effect, Types } from "effect";
|
|
6
|
+
import type { Transform } from "./registration.js";
|
|
7
|
+
/** Provider metadata and immutable source definitions, including inactive providers. */
|
|
8
|
+
export interface ProviderRecord {
|
|
9
|
+
readonly provider: Provider.Info;
|
|
10
|
+
readonly models: ReadonlyMap<string, Model.Info>;
|
|
11
|
+
readonly sourceConnection?: ConnectionInfo;
|
|
12
|
+
}
|
|
13
|
+
export interface ProviderEditor {
|
|
14
|
+
list(): readonly ProviderRecord[];
|
|
15
|
+
get(providerID: string): ProviderRecord | undefined;
|
|
16
|
+
/** A discovered account-specific inventory can be bound to the connection that produced it. */
|
|
17
|
+
add(input: {
|
|
18
|
+
info: Provider.Info;
|
|
19
|
+
models: readonly Model.Info[];
|
|
20
|
+
sourceConnection?: ConnectionInfo;
|
|
21
|
+
}): void;
|
|
22
|
+
update(providerID: string, update: (provider: Types.DeepMutable<Provider.Info>) => void): void;
|
|
23
|
+
remove(providerID: string): void;
|
|
24
|
+
readonly models: {
|
|
25
|
+
set(providerID: string, models: readonly Model.Info[]): void;
|
|
26
|
+
/** Updates an owned copy of a source definition. */
|
|
27
|
+
update(providerID: string, modelID: string, update: (model: Types.DeepMutable<Model.Info>) => void): void;
|
|
28
|
+
remove(providerID: string, modelID: string): void;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface ProviderDomain extends ProviderApi<unknown> {
|
|
32
|
+
readonly transform: Transform<ProviderEditor>;
|
|
33
|
+
readonly reload: () => Effect.Effect<void>;
|
|
34
|
+
}
|
|
File without changes
|
package/dist/effect/session.d.ts
CHANGED
|
@@ -77,6 +77,18 @@ export interface SessionHttpResponse {
|
|
|
77
77
|
readonly request: Request;
|
|
78
78
|
response: Response;
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Connection a WebSocket-backed request opens or reuses. Runs once per model call before the
|
|
82
|
+
* Session's socket is selected; changing `url` or `headers` reopens the socket. Experimental.
|
|
83
|
+
*/
|
|
84
|
+
export interface SessionWebSocketHandshake {
|
|
85
|
+
readonly sessionID: Session.ID;
|
|
86
|
+
readonly agent: Agent.ID;
|
|
87
|
+
readonly model: Model.Ref;
|
|
88
|
+
readonly kind: SessionRequestKind;
|
|
89
|
+
url: string;
|
|
90
|
+
headers: Record<string, string>;
|
|
91
|
+
}
|
|
80
92
|
export type SessionRetryDecision = {
|
|
81
93
|
retry: false;
|
|
82
94
|
} | {
|
|
@@ -100,8 +112,9 @@ export interface SessionHooks {
|
|
|
100
112
|
readonly "model.request": SessionModelRequest;
|
|
101
113
|
readonly "http.request": SessionHttpRequest;
|
|
102
114
|
readonly "http.response": SessionHttpResponse;
|
|
115
|
+
readonly "experimental.ws.handshake": SessionWebSocketHandshake;
|
|
103
116
|
readonly retry: SessionRetry;
|
|
104
117
|
}
|
|
105
|
-
export type SessionDomain = Pick<SessionApi<unknown>, "create" | "get" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "synthetic" | "interrupt" | "
|
|
118
|
+
export type SessionDomain = Pick<SessionApi<unknown>, "create" | "get" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "synthetic" | "interrupt" | "update" | "move" | "wait" | "context"> & {
|
|
106
119
|
readonly hook: ModelHooks<SessionHooks>;
|
|
107
120
|
};
|
package/dist/promise/adapter.js
CHANGED
|
@@ -78,6 +78,7 @@ const rpcFromEffect = Effect.fn("Plugin.Rpc.fromEffect")(function* (host, stream
|
|
|
78
78
|
try: (signal) => {
|
|
79
79
|
// SAFETY: Promise RPC handlers return Promise values before this adapter erases their concrete types.
|
|
80
80
|
// oxlint-disable-next-line typescript-eslint/no-unsafe-type-assertion
|
|
81
|
+
// oxlint-disable-next-line no-restricted-globals -- The portable RPC registry intentionally erases each handler's concrete signature.
|
|
81
82
|
return Reflect.apply(handler, undefined, [
|
|
82
83
|
input,
|
|
83
84
|
{
|
|
@@ -209,18 +210,6 @@ export function fromPromise(plugin) {
|
|
|
209
210
|
aisdk: {
|
|
210
211
|
hook: (name, callback, options) => register(host.aisdk.hook(name, (event) => Effect.promise(() => Promise.resolve(callback(event))), options)),
|
|
211
212
|
},
|
|
212
|
-
catalog: {
|
|
213
|
-
provider: {
|
|
214
|
-
list: adaptApiMethod(ProviderEndpoints["provider.list"], host.catalog.provider.list),
|
|
215
|
-
get: adaptApiMethod(ProviderEndpoints["provider.get"], host.catalog.provider.get),
|
|
216
|
-
},
|
|
217
|
-
model: {
|
|
218
|
-
list: adaptApiMethod(ModelEndpoints["model.list"], host.catalog.model.list),
|
|
219
|
-
default: adaptApiMethod(ModelEndpoints["model.default"], host.catalog.model.default),
|
|
220
|
-
},
|
|
221
|
-
transform: transform(host.catalog),
|
|
222
|
-
reload: () => run(host.catalog.reload()),
|
|
223
|
-
},
|
|
224
213
|
command: {
|
|
225
214
|
list: adaptApiMethod(CommandEndpoints["command.list"], host.command.list),
|
|
226
215
|
transform: (callback) => register(host.command.transform((editor) => callback({
|
|
@@ -242,6 +231,18 @@ export function fromPromise(plugin) {
|
|
|
242
231
|
generate: {
|
|
243
232
|
text: adaptApiMethod(GenerateEndpoints["generate.text"], host.generate.text),
|
|
244
233
|
},
|
|
234
|
+
model: {
|
|
235
|
+
list: adaptApiMethod(ModelEndpoints["model.list"], host.model.list),
|
|
236
|
+
default: adaptApiMethod(ModelEndpoints["model.default"], host.model.default),
|
|
237
|
+
transform: transform(host.model),
|
|
238
|
+
reload: () => run(host.model.reload()),
|
|
239
|
+
},
|
|
240
|
+
provider: {
|
|
241
|
+
list: adaptApiMethod(ProviderEndpoints["provider.list"], host.provider.list),
|
|
242
|
+
get: adaptApiMethod(ProviderEndpoints["provider.get"], host.provider.get),
|
|
243
|
+
transform: transform(host.provider),
|
|
244
|
+
reload: () => run(host.provider.reload()),
|
|
245
|
+
},
|
|
245
246
|
integration: {
|
|
246
247
|
list: adaptApiMethod(IntegrationEndpoints["integration.list"], host.integration.list),
|
|
247
248
|
get: adaptApiMethod(IntegrationEndpoints["integration.get"], host.integration.get),
|
|
@@ -305,7 +306,6 @@ export function fromPromise(plugin) {
|
|
|
305
306
|
list: adaptApiMethod(PermissionEndpoints["session.permission.list"], host.permission.list),
|
|
306
307
|
get: adaptApiMethod(PermissionEndpoints["session.permission.get"], host.permission.get),
|
|
307
308
|
reply: adaptApiMethod(PermissionEndpoints["session.permission.reply"], host.permission.reply),
|
|
308
|
-
rules: adaptApiMethod(PermissionEndpoints["session.permission.rules"], host.permission.rules),
|
|
309
309
|
},
|
|
310
310
|
plugin: {
|
|
311
311
|
list: adaptApiMethod(PluginEndpoints["plugin.list"], host.plugin.list),
|
|
@@ -359,7 +359,9 @@ export function fromPromise(plugin) {
|
|
|
359
359
|
vcs: {
|
|
360
360
|
get: adaptApiMethod(VcsEndpoints["vcs.get"], host.vcs.get),
|
|
361
361
|
base: adaptApiMethod(VcsEndpoints["vcs.base"], host.vcs.base),
|
|
362
|
-
|
|
362
|
+
branch: {
|
|
363
|
+
list: adaptApiMethod(VcsEndpoints["vcs.branch.list"], host.vcs.branch.list),
|
|
364
|
+
},
|
|
363
365
|
status: adaptApiMethod(VcsEndpoints["vcs.status"], host.vcs.status),
|
|
364
366
|
diff: adaptApiMethod(VcsEndpoints["vcs.diff"], host.vcs.diff),
|
|
365
367
|
reload: () => run(host.vcs.reload()),
|
|
@@ -422,7 +424,7 @@ export function fromPromise(plugin) {
|
|
|
422
424
|
command: adaptApiMethod(SessionEndpoints["session.command"], host.session.command),
|
|
423
425
|
synthetic: adaptApiMethod(SessionEndpoints["session.synthetic"], host.session.synthetic),
|
|
424
426
|
interrupt: adaptApiMethod(SessionEndpoints["session.interrupt"], host.session.interrupt),
|
|
425
|
-
|
|
427
|
+
update: adaptApiMethod(SessionEndpoints["session.update"], host.session.update),
|
|
426
428
|
move: adaptApiMethod(SessionEndpoints["session.move"], host.session.move),
|
|
427
429
|
wait: adaptApiMethod(SessionEndpoints["session.wait"], host.session.wait),
|
|
428
430
|
context: adaptApiMethod(SessionEndpoints["session.context"], host.session.context),
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ModelApi } from "@opencode/client/promise/api";
|
|
2
|
+
import type { Model } from "@opencode/schema/model";
|
|
3
|
+
import type { ProviderRecord } from "./provider.js";
|
|
4
|
+
import type { Transform } from "./registration.js";
|
|
5
|
+
import type { DeepMutable } from "./types.js";
|
|
6
|
+
export interface ModelEditor {
|
|
7
|
+
/** Candidates from available providers, including models disabled by earlier transforms. */
|
|
8
|
+
list(providerID?: string): readonly DeepMutable<Model.Info>[];
|
|
9
|
+
get(providerID: string, modelID: string): DeepMutable<Model.Info> | undefined;
|
|
10
|
+
/** Edits raw model overrides; cannot create an unavailable provider. */
|
|
11
|
+
update(providerID: string, modelID: string, update: (model: DeepMutable<Model.Info>) => void): void;
|
|
12
|
+
remove(providerID: string, modelID: string): void;
|
|
13
|
+
readonly default: {
|
|
14
|
+
get(): {
|
|
15
|
+
providerID: string;
|
|
16
|
+
modelID: string;
|
|
17
|
+
} | undefined;
|
|
18
|
+
set(providerID: string, modelID: string): void;
|
|
19
|
+
};
|
|
20
|
+
/** Immutable provider inputs, including inactive templates, before model transforms. */
|
|
21
|
+
readonly provider: {
|
|
22
|
+
list(): readonly ProviderRecord[];
|
|
23
|
+
get(providerID: string): ProviderRecord | undefined;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface ModelDomain extends ModelApi {
|
|
27
|
+
readonly transform: Transform<ModelEditor>;
|
|
28
|
+
readonly reload: () => Promise<void>;
|
|
29
|
+
}
|
|
File without changes
|
|
@@ -16,6 +16,6 @@ export interface PermissionEvaluation {
|
|
|
16
16
|
export interface PermissionHooks {
|
|
17
17
|
readonly evaluate: PermissionEvaluation;
|
|
18
18
|
}
|
|
19
|
-
export type PermissionDomain = Pick<PermissionApi, "list" | "get" | "reply"
|
|
19
|
+
export type PermissionDomain = Pick<PermissionApi, "list" | "get" | "reply"> & {
|
|
20
20
|
readonly hook: Hooks<PermissionHooks>;
|
|
21
21
|
};
|
package/dist/promise/plugin.d.ts
CHANGED
|
@@ -5,12 +5,13 @@ import type { PluginOptions } from "../options.js";
|
|
|
5
5
|
import type { App } from "../app.js";
|
|
6
6
|
import type { AgentDomain } from "./agent.js";
|
|
7
7
|
import type { AISDKDomain } from "./aisdk.js";
|
|
8
|
-
import type { CatalogDomain } from "./catalog.js";
|
|
9
8
|
import type { CommandDomain } from "./command.js";
|
|
10
9
|
import type { EventDomain } from "./event.js";
|
|
11
10
|
import type { IntegrationDomain } from "./integration.js";
|
|
12
11
|
import type { MCPDomain } from "./mcp.js";
|
|
12
|
+
import type { ModelDomain } from "./model.js";
|
|
13
13
|
import type { PermissionDomain } from "./permission.js";
|
|
14
|
+
import type { ProviderDomain } from "./provider.js";
|
|
14
15
|
import type { ReferenceDomain } from "./reference.js";
|
|
15
16
|
import type { RpcDomain } from "./rpc.js";
|
|
16
17
|
import type { SessionDomain } from "./session.js";
|
|
@@ -27,7 +28,6 @@ export interface Context {
|
|
|
27
28
|
readonly options: PluginOptions;
|
|
28
29
|
readonly agent: AgentDomain;
|
|
29
30
|
readonly aisdk: AISDKDomain;
|
|
30
|
-
readonly catalog: CatalogDomain;
|
|
31
31
|
readonly command: CommandDomain;
|
|
32
32
|
readonly event: EventDomain;
|
|
33
33
|
readonly experimental: {
|
|
@@ -35,9 +35,11 @@ export interface Context {
|
|
|
35
35
|
};
|
|
36
36
|
readonly integration: IntegrationDomain;
|
|
37
37
|
readonly mcp: MCPDomain;
|
|
38
|
+
readonly model: ModelDomain;
|
|
38
39
|
readonly generate: GenerateApi;
|
|
39
40
|
readonly permission: PermissionDomain;
|
|
40
41
|
readonly plugin: Pick<PluginApi, "list">;
|
|
42
|
+
readonly provider: ProviderDomain;
|
|
41
43
|
readonly reference: ReferenceDomain;
|
|
42
44
|
readonly rpc: RpcDomain;
|
|
43
45
|
readonly session: SessionDomain;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ProviderApi } from "@opencode/client/promise/api";
|
|
2
|
+
import type { Model } from "@opencode/schema/model";
|
|
3
|
+
import type { Provider } from "@opencode/schema/provider";
|
|
4
|
+
import type { ConnectionInfo } from "@opencode/client";
|
|
5
|
+
import type { Transform } from "./registration.js";
|
|
6
|
+
import type { DeepMutable } from "./types.js";
|
|
7
|
+
/** Provider metadata and immutable source definitions, including inactive providers. */
|
|
8
|
+
export interface ProviderRecord {
|
|
9
|
+
readonly provider: Provider.Info;
|
|
10
|
+
readonly models: ReadonlyMap<string, Model.Info>;
|
|
11
|
+
readonly sourceConnection?: ConnectionInfo;
|
|
12
|
+
}
|
|
13
|
+
export interface ProviderEditor {
|
|
14
|
+
list(): readonly ProviderRecord[];
|
|
15
|
+
get(providerID: string): ProviderRecord | undefined;
|
|
16
|
+
/** A discovered account-specific inventory can be bound to the connection that produced it. */
|
|
17
|
+
add(input: {
|
|
18
|
+
info: Provider.Info;
|
|
19
|
+
models: readonly Model.Info[];
|
|
20
|
+
sourceConnection?: ConnectionInfo;
|
|
21
|
+
}): void;
|
|
22
|
+
update(providerID: string, update: (provider: DeepMutable<Provider.Info>) => void): void;
|
|
23
|
+
remove(providerID: string): void;
|
|
24
|
+
readonly models: {
|
|
25
|
+
set(providerID: string, models: readonly Model.Info[]): void;
|
|
26
|
+
/** Updates an owned copy of a source definition. */
|
|
27
|
+
update(providerID: string, modelID: string, update: (model: DeepMutable<Model.Info>) => void): void;
|
|
28
|
+
remove(providerID: string, modelID: string): void;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface ProviderDomain extends ProviderApi {
|
|
32
|
+
readonly transform: Transform<ProviderEditor>;
|
|
33
|
+
readonly reload: () => Promise<void>;
|
|
34
|
+
}
|
|
File without changes
|
|
@@ -77,6 +77,18 @@ export interface SessionHttpResponse {
|
|
|
77
77
|
readonly request: Request;
|
|
78
78
|
response: Response;
|
|
79
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Connection a WebSocket-backed request opens or reuses. Runs once per model call before the
|
|
82
|
+
* Session's socket is selected; changing `url` or `headers` reopens the socket. Experimental.
|
|
83
|
+
*/
|
|
84
|
+
export interface SessionWebSocketHandshake {
|
|
85
|
+
readonly sessionID: Session.ID;
|
|
86
|
+
readonly agent: Agent.ID;
|
|
87
|
+
readonly model: Model.Ref;
|
|
88
|
+
readonly kind: SessionRequestKind;
|
|
89
|
+
url: string;
|
|
90
|
+
headers: Record<string, string>;
|
|
91
|
+
}
|
|
80
92
|
export type SessionRetryDecision = {
|
|
81
93
|
retry: false;
|
|
82
94
|
} | {
|
|
@@ -100,8 +112,9 @@ export interface SessionHooks {
|
|
|
100
112
|
readonly "model.request": SessionModelRequest;
|
|
101
113
|
readonly "http.request": SessionHttpRequest;
|
|
102
114
|
readonly "http.response": SessionHttpResponse;
|
|
115
|
+
readonly "experimental.ws.handshake": SessionWebSocketHandshake;
|
|
103
116
|
readonly retry: SessionRetry;
|
|
104
117
|
}
|
|
105
|
-
export type SessionDomain = Pick<SessionApi, "create" | "get" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "synthetic" | "interrupt" | "
|
|
118
|
+
export type SessionDomain = Pick<SessionApi, "create" | "get" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "synthetic" | "interrupt" | "update" | "move" | "wait" | "context"> & {
|
|
106
119
|
readonly hook: ModelHooks<SessionHooks>;
|
|
107
120
|
};
|
package/dist/source.bun.js
CHANGED
|
@@ -4,6 +4,7 @@ import path from "node:path";
|
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
5
|
import { Host } from "./host.js";
|
|
6
6
|
import { localSource } from "./source.js";
|
|
7
|
+
import { missingPackageTarget } from "./source.package.js";
|
|
7
8
|
let generation = Date.now();
|
|
8
9
|
export async function prepareSource(entrypoint, track) {
|
|
9
10
|
const root = fileURLToPath(entrypoint);
|
|
@@ -39,8 +40,17 @@ export async function prepareSource(entrypoint, track) {
|
|
|
39
40
|
const local = item.path.startsWith("./") || item.path.startsWith("../")
|
|
40
41
|
? new URL(item.path, pathToFileURL(file))
|
|
41
42
|
: localSource(item.path, path.dirname(file));
|
|
42
|
-
if (!local)
|
|
43
|
+
if (!local) {
|
|
44
|
+
try {
|
|
45
|
+
Bun.resolveSync(item.path, path.dirname(file));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
const target = missingPackageTarget(item.path, file);
|
|
49
|
+
if (target)
|
|
50
|
+
track(target, true);
|
|
51
|
+
}
|
|
43
52
|
continue;
|
|
53
|
+
}
|
|
44
54
|
const requested = fileURLToPath(local);
|
|
45
55
|
// Resolving a workspace symlink can erase its node_modules boundary.
|
|
46
56
|
if (requested.split(path.sep).includes("node_modules"))
|
package/dist/source.node.js
CHANGED
|
@@ -2,6 +2,7 @@ import { registerHooks } from "node:module";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { localSource } from "./source.js";
|
|
5
|
+
import { missingPackageTarget } from "./source.package.js";
|
|
5
6
|
import { Host } from "./host.js";
|
|
6
7
|
let generation = Date.now();
|
|
7
8
|
export async function prepareSource(entrypoint, track) {
|
|
@@ -18,8 +19,17 @@ export async function prepareSource(entrypoint, track) {
|
|
|
18
19
|
const local = specifier.startsWith("./") || specifier.startsWith("../")
|
|
19
20
|
? new URL(specifier, context.parentURL)
|
|
20
21
|
: localSource(specifier, path.dirname(fileURLToPath(context.parentURL)));
|
|
21
|
-
if (!local)
|
|
22
|
-
|
|
22
|
+
if (!local) {
|
|
23
|
+
try {
|
|
24
|
+
return nextResolve(specifier, context);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
const target = missingPackageTarget(specifier, fileURLToPath(context.parentURL));
|
|
28
|
+
if (target)
|
|
29
|
+
track(target, true);
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
23
33
|
if (fileURLToPath(local).split(path.sep).includes("node_modules"))
|
|
24
34
|
return nextResolve(specifier, context);
|
|
25
35
|
const resolved = (() => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function missingPackageTarget(specifier: string, importer: string): string | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
export function missingPackageTarget(specifier, importer) {
|
|
4
|
+
if (specifier.startsWith("#"))
|
|
5
|
+
return undefined;
|
|
6
|
+
const parts = specifier.split("/");
|
|
7
|
+
const name = specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
|
|
8
|
+
const start = path.dirname(importer);
|
|
9
|
+
for (let directory = start;; directory = path.dirname(directory)) {
|
|
10
|
+
if (existsSync(path.join(directory, "package.json")))
|
|
11
|
+
return path.join(directory, "node_modules", name);
|
|
12
|
+
if (path.dirname(directory) === directory)
|
|
13
|
+
return path.join(start, "node_modules", name);
|
|
14
|
+
}
|
|
15
|
+
}
|
package/dist/tui/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentInfo, CommandInfo,
|
|
1
|
+
import type { AgentInfo, CommandInfo, SessionFormCancelInput, FormInfo, SessionFormReplyInput, IntegrationInfo, LocationRef, McpResource, McpServer, ModelInfo, OpenCodeClient, OpenCodeEvent, PermissionSavedInfo, PermissionRequest, Project, ProviderInfo, ReferenceInfo, SessionInfo, SessionMessageInfo, SessionInboxInfo, ShellInfo, SkillInfo, VcsInfo } from "@opencode/client";
|
|
2
2
|
import type { ResolvedTheme } from "@opencode/theme/tui";
|
|
3
3
|
import type { CliRenderer, KeyEvent, MarkdownCodeBlockRenderer, Renderable } from "@opentui/core";
|
|
4
4
|
import type { JSX } from "@opentui/solid";
|
|
@@ -66,8 +66,8 @@ export interface Data {
|
|
|
66
66
|
}> | undefined;
|
|
67
67
|
sync(sessionID: string, location?: LocationRef): Promise<void>;
|
|
68
68
|
invalidate(sessionID: string, location?: LocationRef): void;
|
|
69
|
-
reply(input:
|
|
70
|
-
cancel(input:
|
|
69
|
+
reply(input: SessionFormReplyInput, location?: LocationRef): Promise<void>;
|
|
70
|
+
cancel(input: SessionFormCancelInput, location?: LocationRef): Promise<void>;
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
73
|
readonly project: {
|
|
@@ -161,6 +161,7 @@ export interface PanelInput {
|
|
|
161
161
|
export interface SlotMap {
|
|
162
162
|
readonly app: Readonly<Record<string, never>>;
|
|
163
163
|
readonly "home.footer": Readonly<Record<string, never>>;
|
|
164
|
+
readonly "home.footer.status": Readonly<Record<string, never>>;
|
|
164
165
|
readonly "prompt.footer": PromptFooterInput;
|
|
165
166
|
readonly "prompt.footer.status": PromptFooterInput;
|
|
166
167
|
readonly "prompt.footer.file": PromptFooterInput;
|
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.4",
|
|
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.4",
|
|
47
|
+
"@opencode/client": "2.0.4",
|
|
48
|
+
"@opencode/protocol": "2.0.4",
|
|
49
|
+
"@opencode/schema": "2.0.4",
|
|
50
|
+
"@opencode/util": "2.0.4",
|
|
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.4",
|
|
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.4",
|
|
77
77
|
"@opentui/core": "0.5.10",
|
|
78
78
|
"@opentui/solid": "0.5.10",
|
|
79
79
|
"@tsconfig/bun": "1.0.9",
|
package/dist/effect/catalog.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { CatalogApi } from "@opencode/client/effect/api";
|
|
2
|
-
import { Model } from "@opencode/schema/model";
|
|
3
|
-
import { Provider } from "@opencode/schema/provider";
|
|
4
|
-
import type { Effect, Types } from "effect";
|
|
5
|
-
import type { Transform } from "./registration.js";
|
|
6
|
-
export interface CatalogProviderRecord {
|
|
7
|
-
readonly provider: Types.DeepMutable<Provider.Info>;
|
|
8
|
-
readonly models: ReadonlyMap<string, Types.DeepMutable<Model.Info>>;
|
|
9
|
-
}
|
|
10
|
-
export interface CatalogEditor {
|
|
11
|
-
readonly provider: {
|
|
12
|
-
list(): readonly CatalogProviderRecord[];
|
|
13
|
-
get(providerID: string): CatalogProviderRecord | undefined;
|
|
14
|
-
update(providerID: string, update: (provider: Types.DeepMutable<Provider.Info>) => void): void;
|
|
15
|
-
remove(providerID: string): void;
|
|
16
|
-
};
|
|
17
|
-
readonly model: {
|
|
18
|
-
get(providerID: string, modelID: string): Types.DeepMutable<Model.Info> | undefined;
|
|
19
|
-
update(providerID: string, modelID: string, update: (model: Types.DeepMutable<Model.Info>) => void): void;
|
|
20
|
-
remove(providerID: string, modelID: string): void;
|
|
21
|
-
readonly default: {
|
|
22
|
-
get(): {
|
|
23
|
-
providerID: string;
|
|
24
|
-
modelID: string;
|
|
25
|
-
} | undefined;
|
|
26
|
-
set(providerID: string, modelID: string): void;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export interface CatalogDomain extends CatalogApi<unknown> {
|
|
31
|
-
readonly transform: Transform<CatalogEditor>;
|
|
32
|
-
readonly reload: () => Effect.Effect<void>;
|
|
33
|
-
}
|
package/dist/effect/catalog.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { CatalogApi } from "@opencode/client/promise/api";
|
|
2
|
-
import type { Model } from "@opencode/schema/model";
|
|
3
|
-
import type { Provider } from "@opencode/schema/provider";
|
|
4
|
-
import type { Transform } from "./registration.js";
|
|
5
|
-
import type { DeepMutable } from "./types.js";
|
|
6
|
-
export interface CatalogProviderRecord {
|
|
7
|
-
readonly provider: DeepMutable<Provider.Info>;
|
|
8
|
-
readonly models: ReadonlyMap<string, DeepMutable<Model.Info>>;
|
|
9
|
-
}
|
|
10
|
-
export interface CatalogEditor {
|
|
11
|
-
readonly provider: {
|
|
12
|
-
list(): readonly CatalogProviderRecord[];
|
|
13
|
-
get(providerID: string): CatalogProviderRecord | undefined;
|
|
14
|
-
update(providerID: string, update: (provider: DeepMutable<Provider.Info>) => void): void;
|
|
15
|
-
remove(providerID: string): void;
|
|
16
|
-
};
|
|
17
|
-
readonly model: {
|
|
18
|
-
get(providerID: string, modelID: string): DeepMutable<Model.Info> | undefined;
|
|
19
|
-
update(providerID: string, modelID: string, update: (model: DeepMutable<Model.Info>) => void): void;
|
|
20
|
-
remove(providerID: string, modelID: string): void;
|
|
21
|
-
readonly default: {
|
|
22
|
-
get(): {
|
|
23
|
-
providerID: string;
|
|
24
|
-
modelID: string;
|
|
25
|
-
} | undefined;
|
|
26
|
-
set(providerID: string, modelID: string): void;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export interface CatalogDomain extends CatalogApi {
|
|
31
|
-
readonly transform: Transform<CatalogEditor>;
|
|
32
|
-
readonly reload: () => Promise<void>;
|
|
33
|
-
}
|
|
File without changes
|