@opencode-ai/plugin 0.0.0-dev-17987 → 0.0.0-dev-202608231534
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/example-workspace.d.ts +3 -0
- package/dist/example-workspace.js +30 -0
- package/dist/example.d.ts +2 -0
- package/dist/example.js +16 -0
- package/dist/index.d.ts +322 -0
- package/dist/index.js +1 -0
- package/dist/shell.d.ts +109 -0
- package/dist/shell.js +1 -0
- package/dist/tool.d.ts +60 -0
- package/dist/tool.js +5 -0
- package/dist/tui.d.ts +510 -0
- package/dist/tui.js +7 -0
- package/dist/v2/effect/agent.d.ts +12 -0
- package/dist/v2/effect/agent.js +1 -0
- package/dist/{effect → v2/effect}/aisdk.d.ts +6 -9
- package/dist/v2/effect/aisdk.js +1 -0
- package/dist/v2/effect/catalog.d.ts +29 -0
- package/dist/v2/effect/catalog.js +1 -0
- package/dist/v2/effect/command.d.ts +11 -0
- package/dist/v2/effect/command.js +1 -0
- package/dist/v2/effect/context.d.ts +21 -0
- package/dist/v2/effect/context.js +1 -0
- package/dist/v2/effect/event.d.ts +8 -0
- package/dist/v2/effect/event.js +1 -0
- package/dist/v2/effect/filesystem.d.ts +23 -0
- package/dist/v2/effect/filesystem.js +1 -0
- package/dist/v2/effect/index.d.ts +3 -0
- package/dist/v2/effect/index.js +1 -0
- package/dist/v2/effect/integration.d.ts +46 -0
- package/dist/v2/effect/integration.js +1 -0
- package/dist/v2/effect/location.d.ts +6 -0
- package/dist/v2/effect/location.js +1 -0
- package/dist/v2/effect/npm.d.ts +7 -0
- package/dist/v2/effect/npm.js +1 -0
- package/dist/v2/effect/path.d.ts +8 -0
- package/dist/v2/effect/path.js +1 -0
- package/dist/v2/effect/plugin.d.ts +11 -0
- package/dist/{promise → v2/effect}/reference.d.ts +5 -7
- package/dist/v2/effect/reference.js +1 -0
- package/dist/v2/effect/registration.d.ts +10 -0
- package/dist/v2/effect/registration.js +1 -0
- package/dist/v2/effect/skill.d.ts +9 -0
- package/dist/v2/effect/skill.js +1 -0
- package/dist/v2/options.js +1 -0
- package/dist/v2/promise/agent.d.ts +6 -0
- package/dist/v2/promise/agent.js +1 -0
- package/dist/{promise → v2/promise}/aisdk.d.ts +6 -9
- package/dist/v2/promise/aisdk.js +1 -0
- package/dist/v2/promise/catalog.d.ts +6 -0
- package/dist/v2/promise/catalog.js +1 -0
- package/dist/v2/promise/command.d.ts +6 -0
- package/dist/v2/promise/command.js +1 -0
- package/dist/v2/promise/context.d.ts +21 -0
- package/dist/v2/promise/context.js +1 -0
- package/dist/v2/promise/index.d.ts +12 -0
- package/dist/v2/promise/index.js +1 -0
- package/dist/v2/promise/integration.d.ts +12 -0
- package/dist/v2/promise/integration.js +1 -0
- package/dist/v2/promise/plugin.d.ts +10 -0
- package/dist/v2/promise/reference.d.ts +6 -0
- package/dist/v2/promise/reference.js +1 -0
- package/dist/v2/promise/registration.d.ts +9 -0
- package/dist/v2/promise/registration.js +1 -0
- package/dist/v2/promise/skill.d.ts +6 -0
- package/dist/v2/promise/skill.js +1 -0
- package/package.json +34 -33
- package/dist/app.d.ts +0 -5
- package/dist/app.js +0 -0
- package/dist/effect/agent.d.ts +0 -15
- package/dist/effect/agent.js +0 -0
- package/dist/effect/aisdk.js +0 -0
- package/dist/effect/catalog.d.ts +0 -33
- package/dist/effect/catalog.js +0 -2
- package/dist/effect/command.d.ts +0 -14
- package/dist/effect/command.js +0 -0
- package/dist/effect/event.d.ts +0 -3
- package/dist/effect/event.js +0 -0
- package/dist/effect/index.d.ts +0 -13
- package/dist/effect/index.js +0 -12
- package/dist/effect/integration.d.ts +0 -80
- package/dist/effect/integration.js +0 -2
- package/dist/effect/mcp.d.ts +0 -15
- package/dist/effect/mcp.js +0 -0
- package/dist/effect/plugin.d.ts +0 -43
- package/dist/effect/reference.d.ts +0 -13
- package/dist/effect/reference.js +0 -0
- package/dist/effect/registration.d.ts +0 -11
- package/dist/effect/registration.js +0 -0
- package/dist/effect/session.d.ts +0 -47
- package/dist/effect/session.js +0 -0
- package/dist/effect/shell.d.ts +0 -14
- package/dist/effect/shell.js +0 -0
- package/dist/effect/skill.d.ts +0 -14
- package/dist/effect/skill.js +0 -1
- package/dist/effect/storage.d.ts +0 -8
- package/dist/effect/storage.js +0 -0
- package/dist/effect/tool.d.ts +0 -40
- package/dist/effect/tool.js +0 -1
- package/dist/effect/websearch.d.ts +0 -20
- package/dist/effect/websearch.js +0 -0
- package/dist/options.js +0 -0
- package/dist/promise/adapter.d.ts +0 -12
- package/dist/promise/adapter.js +0 -257
- package/dist/promise/agent.d.ts +0 -15
- package/dist/promise/agent.js +0 -0
- package/dist/promise/aisdk.js +0 -0
- package/dist/promise/catalog.d.ts +0 -33
- package/dist/promise/catalog.js +0 -0
- package/dist/promise/command.d.ts +0 -13
- package/dist/promise/command.js +0 -0
- package/dist/promise/event.d.ts +0 -3
- package/dist/promise/event.js +0 -0
- package/dist/promise/index.d.ts +0 -14
- package/dist/promise/index.js +0 -12
- package/dist/promise/integration.d.ts +0 -79
- package/dist/promise/integration.js +0 -2
- package/dist/promise/mcp.d.ts +0 -15
- package/dist/promise/mcp.js +0 -0
- package/dist/promise/plugin.d.ts +0 -43
- package/dist/promise/reference.js +0 -0
- package/dist/promise/registration.d.ts +0 -10
- package/dist/promise/registration.js +0 -0
- package/dist/promise/session.d.ts +0 -47
- package/dist/promise/session.js +0 -0
- package/dist/promise/shell.d.ts +0 -14
- package/dist/promise/shell.js +0 -0
- package/dist/promise/skill.d.ts +0 -14
- package/dist/promise/skill.js +0 -0
- package/dist/promise/storage.d.ts +0 -8
- package/dist/promise/storage.js +0 -0
- package/dist/promise/tool.d.ts +0 -44
- package/dist/promise/tool.js +0 -2
- package/dist/promise/types.d.ts +0 -3
- package/dist/promise/types.js +0 -0
- package/dist/promise/websearch.d.ts +0 -21
- package/dist/promise/websearch.js +0 -0
- package/dist/storage.d.ts +0 -14
- package/dist/storage.js +0 -0
- package/dist/tui/context.d.ts +0 -421
- package/dist/tui/context.js +0 -0
- package/dist/tui/index.d.ts +0 -2
- package/dist/tui/index.js +0 -2
- package/dist/tui/plugin.d.ts +0 -8
- package/dist/tui/plugin.js +0 -3
- package/dist/tui/solid.d.ts +0 -7
- package/dist/tui/solid.js +0 -16
- /package/dist/{effect → v2/effect}/plugin.js +0 -0
- /package/dist/{options.d.ts → v2/options.d.ts} +0 -0
- /package/dist/{promise → v2/promise}/plugin.js +0 -0
package/dist/effect/mcp.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { McpApi } from "@opencode-ai/client/effect/api";
|
|
2
|
-
import type { Mcp } from "@opencode-ai/schema/mcp";
|
|
3
|
-
import type { Effect, Types } from "effect";
|
|
4
|
-
import type { Transform } from "./registration.js";
|
|
5
|
-
export interface MCPDraft {
|
|
6
|
-
list(): readonly [string, Types.DeepMutable<Mcp.ServerConfig>][];
|
|
7
|
-
get(name: string): Types.DeepMutable<Mcp.ServerConfig> | undefined;
|
|
8
|
-
set(name: string, config: Mcp.ServerConfig): void;
|
|
9
|
-
update(name: string, update: (config: Types.DeepMutable<Mcp.ServerConfig>) => void): void;
|
|
10
|
-
remove(name: string): void;
|
|
11
|
-
}
|
|
12
|
-
export interface MCPDomain extends Omit<McpApi<unknown>, "resource"> {
|
|
13
|
-
readonly transform: Transform<MCPDraft>;
|
|
14
|
-
readonly reload: () => Effect.Effect<void>;
|
|
15
|
-
}
|
package/dist/effect/mcp.js
DELETED
|
File without changes
|
package/dist/effect/plugin.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { PluginApi } from "@opencode-ai/client/effect/api";
|
|
2
|
-
import type { Effect, Scope } from "effect";
|
|
3
|
-
import type { PluginOptions } from "../options.js";
|
|
4
|
-
import type { App } from "../app.js";
|
|
5
|
-
import type { AgentDomain } from "./agent.js";
|
|
6
|
-
import type { AISDKDomain } from "./aisdk.js";
|
|
7
|
-
import type { CatalogDomain } from "./catalog.js";
|
|
8
|
-
import type { CommandDomain } from "./command.js";
|
|
9
|
-
import type { EventDomain } from "./event.js";
|
|
10
|
-
import type { IntegrationDomain } from "./integration.js";
|
|
11
|
-
import type { MCPDomain } from "./mcp.js";
|
|
12
|
-
import type { ReferenceDomain } from "./reference.js";
|
|
13
|
-
import type { SessionDomain } from "./session.js";
|
|
14
|
-
import type { ShellDomain } from "./shell.js";
|
|
15
|
-
import type { SkillDomain } from "./skill.js";
|
|
16
|
-
import type { StorageDomain } from "./storage.js";
|
|
17
|
-
import type { ToolDomain } from "./tool.js";
|
|
18
|
-
import type { WebSearchDomain } from "./websearch.js";
|
|
19
|
-
export interface Context {
|
|
20
|
-
readonly app: App;
|
|
21
|
-
readonly options: PluginOptions;
|
|
22
|
-
readonly agent: AgentDomain;
|
|
23
|
-
readonly aisdk: AISDKDomain;
|
|
24
|
-
readonly catalog: CatalogDomain;
|
|
25
|
-
readonly command: CommandDomain;
|
|
26
|
-
readonly event: EventDomain;
|
|
27
|
-
readonly integration: IntegrationDomain;
|
|
28
|
-
readonly mcp: MCPDomain;
|
|
29
|
-
readonly plugin: PluginApi<unknown>;
|
|
30
|
-
readonly reference: ReferenceDomain;
|
|
31
|
-
readonly session: SessionDomain;
|
|
32
|
-
readonly shell: ShellDomain;
|
|
33
|
-
readonly skill: SkillDomain;
|
|
34
|
-
readonly storage: StorageDomain;
|
|
35
|
-
readonly tool: ToolDomain;
|
|
36
|
-
readonly websearch: WebSearchDomain;
|
|
37
|
-
}
|
|
38
|
-
export interface Plugin<R = Scope.Scope> {
|
|
39
|
-
readonly id: string;
|
|
40
|
-
readonly tui?: boolean;
|
|
41
|
-
readonly effect: (context: Context) => Effect.Effect<void, never, R>;
|
|
42
|
-
}
|
|
43
|
-
export declare function define<R = Scope.Scope>(plugin: Plugin<R>): Plugin<R>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ReferenceGitSource, ReferenceLocalSource } from "@opencode-ai/client";
|
|
2
|
-
import type { ReferenceApi } from "@opencode-ai/client/effect/api";
|
|
3
|
-
import type { Effect } from "effect";
|
|
4
|
-
import type { Transform } from "./registration.js";
|
|
5
|
-
export interface ReferenceDraft {
|
|
6
|
-
add(name: string, source: ReferenceLocalSource | ReferenceGitSource): void;
|
|
7
|
-
remove(name: string): void;
|
|
8
|
-
list(): readonly (readonly [string, ReferenceLocalSource | ReferenceGitSource])[];
|
|
9
|
-
}
|
|
10
|
-
export interface ReferenceDomain extends ReferenceApi<unknown> {
|
|
11
|
-
readonly transform: Transform<ReferenceDraft>;
|
|
12
|
-
readonly reload: () => Effect.Effect<void>;
|
|
13
|
-
}
|
package/dist/effect/reference.js
DELETED
|
File without changes
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Effect, Scope } from "effect";
|
|
2
|
-
export interface Registration {
|
|
3
|
-
readonly dispose: Effect.Effect<void>;
|
|
4
|
-
}
|
|
5
|
-
export interface ModelHookOptions {
|
|
6
|
-
/** Limits the hook to one provider. Unscoped hooks apply to every provider. */
|
|
7
|
-
readonly providerID?: string;
|
|
8
|
-
}
|
|
9
|
-
export type Hooks<Spec, Failures extends Record<keyof Spec, unknown> = Record<keyof Spec, never>> = <Name extends keyof Spec>(name: Name, callback: (input: Spec[Name]) => Effect.Effect<void, Failures[Name]>) => Effect.Effect<Registration, never, Scope.Scope>;
|
|
10
|
-
export type ModelHooks<Spec, Failures extends Record<keyof Spec, unknown> = Record<keyof Spec, never>> = <Name extends keyof Spec>(name: Name, callback: (input: Spec[Name]) => Effect.Effect<void, Failures[Name]>, options?: ModelHookOptions) => Effect.Effect<Registration, never, Scope.Scope>;
|
|
11
|
-
export type Transform<Input> = (callback: (input: Input) => void) => Effect.Effect<Registration, never, Scope.Scope>;
|
|
File without changes
|
package/dist/effect/session.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { SessionApi } from "@opencode-ai/client/effect/api";
|
|
2
|
-
import type { Message, SystemPart } from "@opencode-ai/ai";
|
|
3
|
-
import type { Agent } from "@opencode-ai/schema/agent";
|
|
4
|
-
import type { Model } from "@opencode-ai/schema/model";
|
|
5
|
-
import type { Session } from "@opencode-ai/schema/session";
|
|
6
|
-
import type { JsonSchema } from "effect";
|
|
7
|
-
import type { ModelHooks } from "./registration.js";
|
|
8
|
-
export interface SessionContext {
|
|
9
|
-
readonly sessionID: Session.ID;
|
|
10
|
-
readonly agent: Agent.ID;
|
|
11
|
-
readonly model: Model.Ref;
|
|
12
|
-
system: Array<SystemPart>;
|
|
13
|
-
messages: Array<Message>;
|
|
14
|
-
tools: Record<string, {
|
|
15
|
-
description: string;
|
|
16
|
-
input: JsonSchema.JsonSchema;
|
|
17
|
-
}>;
|
|
18
|
-
}
|
|
19
|
-
export interface SessionModelRequest {
|
|
20
|
-
readonly sessionID: Session.ID;
|
|
21
|
-
readonly agent: Agent.ID;
|
|
22
|
-
readonly model: Model.Ref;
|
|
23
|
-
baseURL?: string;
|
|
24
|
-
headers: Record<string, string>;
|
|
25
|
-
}
|
|
26
|
-
export interface SessionHttpRequest {
|
|
27
|
-
readonly sessionID: Session.ID;
|
|
28
|
-
readonly agent: Agent.ID;
|
|
29
|
-
readonly model: Model.Ref;
|
|
30
|
-
request: Request;
|
|
31
|
-
}
|
|
32
|
-
export interface SessionHttpResponse {
|
|
33
|
-
readonly sessionID: Session.ID;
|
|
34
|
-
readonly agent: Agent.ID;
|
|
35
|
-
readonly model: Model.Ref;
|
|
36
|
-
readonly request: Request;
|
|
37
|
-
response: Response;
|
|
38
|
-
}
|
|
39
|
-
export interface SessionHooks {
|
|
40
|
-
readonly context: SessionContext;
|
|
41
|
-
readonly "model.request": SessionModelRequest;
|
|
42
|
-
readonly "http.request": SessionHttpRequest;
|
|
43
|
-
readonly "http.response": SessionHttpResponse;
|
|
44
|
-
}
|
|
45
|
-
export type SessionDomain = Pick<SessionApi<unknown>, "create" | "get" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "synthetic" | "interrupt" | "rename" | "wait"> & {
|
|
46
|
-
readonly hook: ModelHooks<SessionHooks>;
|
|
47
|
-
};
|
package/dist/effect/session.js
DELETED
|
File without changes
|
package/dist/effect/shell.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Hooks } from "./registration.js";
|
|
2
|
-
export interface ShellCreateBefore {
|
|
3
|
-
command: string;
|
|
4
|
-
cwd: string;
|
|
5
|
-
timeout: number;
|
|
6
|
-
shell: string;
|
|
7
|
-
env: Record<string, string | undefined>;
|
|
8
|
-
}
|
|
9
|
-
export interface ShellHooks {
|
|
10
|
-
readonly "create.before": ShellCreateBefore;
|
|
11
|
-
}
|
|
12
|
-
export interface ShellDomain {
|
|
13
|
-
readonly hook: Hooks<ShellHooks>;
|
|
14
|
-
}
|
package/dist/effect/shell.js
DELETED
|
File without changes
|
package/dist/effect/skill.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { SkillApi } from "@opencode-ai/client/effect/api";
|
|
2
|
-
import { Skill } from "@opencode-ai/schema/skill";
|
|
3
|
-
import type { Effect, Types } from "effect";
|
|
4
|
-
import type { Transform } from "./registration.js";
|
|
5
|
-
export interface SkillDraft {
|
|
6
|
-
list(): readonly Types.DeepMutable<Skill.Info>[];
|
|
7
|
-
add(skill: Skill.Info): void;
|
|
8
|
-
update(id: string, update: (skill: Types.DeepMutable<Skill.Info>) => void): void;
|
|
9
|
-
remove(id: string): void;
|
|
10
|
-
}
|
|
11
|
-
export interface SkillDomain extends SkillApi<unknown> {
|
|
12
|
-
readonly transform: Transform<SkillDraft>;
|
|
13
|
-
readonly reload: () => Effect.Effect<void>;
|
|
14
|
-
}
|
package/dist/effect/skill.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { Skill } from "@opencode-ai/schema/skill";
|
package/dist/effect/storage.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Effect, Schema } from "effect";
|
|
2
|
-
import type { StorageScanOptions, StorageScanResult } from "../storage.js";
|
|
3
|
-
export interface StorageDomain {
|
|
4
|
-
readonly get: (key: string) => Effect.Effect<Schema.Json | undefined>;
|
|
5
|
-
readonly set: (key: string, value: Schema.Json) => Effect.Effect<void>;
|
|
6
|
-
readonly remove: (key: string) => Effect.Effect<void>;
|
|
7
|
-
readonly scan: (options: StorageScanOptions) => Effect.Effect<StorageScanResult>;
|
|
8
|
-
}
|
package/dist/effect/storage.js
DELETED
|
File without changes
|
package/dist/effect/tool.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Tool } from "@opencode-ai/schema/tool";
|
|
2
|
-
import type { Agent } from "@opencode-ai/schema/agent";
|
|
3
|
-
import type { Session } from "@opencode-ai/schema/session";
|
|
4
|
-
import type { SessionMessage } from "@opencode-ai/schema/session-message";
|
|
5
|
-
import type { Hooks, Transform } from "./registration.js";
|
|
6
|
-
export interface ToolDraft {
|
|
7
|
-
add<Input extends Tool.ValueSchema<any>, Output extends Tool.ValueSchema<any> | undefined>(tool: Tool.Info<Input, Output>): void;
|
|
8
|
-
}
|
|
9
|
-
export interface ToolHooks {
|
|
10
|
-
readonly "execute.before": {
|
|
11
|
-
readonly tool: string;
|
|
12
|
-
readonly sessionID: Session.ID;
|
|
13
|
-
readonly agent: Agent.ID;
|
|
14
|
-
readonly messageID: SessionMessage.ID;
|
|
15
|
-
readonly id: Tool.CallID;
|
|
16
|
-
input: unknown;
|
|
17
|
-
};
|
|
18
|
-
readonly "execute.after": {
|
|
19
|
-
readonly tool: string;
|
|
20
|
-
readonly sessionID: Session.ID;
|
|
21
|
-
readonly agent: Agent.ID;
|
|
22
|
-
readonly messageID: SessionMessage.ID;
|
|
23
|
-
readonly id: Tool.CallID;
|
|
24
|
-
readonly input: unknown;
|
|
25
|
-
} & ({
|
|
26
|
-
readonly status: "completed";
|
|
27
|
-
result: Tool.Result;
|
|
28
|
-
} | {
|
|
29
|
-
readonly status: "error";
|
|
30
|
-
error: Tool.Error;
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
export interface ToolFailures extends Record<keyof ToolHooks, unknown> {
|
|
34
|
-
readonly "execute.before": Tool.Error;
|
|
35
|
-
readonly "execute.after": never;
|
|
36
|
-
}
|
|
37
|
-
export interface ToolDomain {
|
|
38
|
-
readonly transform: Transform<ToolDraft>;
|
|
39
|
-
readonly hook: Hooks<ToolHooks, ToolFailures>;
|
|
40
|
-
}
|
package/dist/effect/tool.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import { Tool } from "@opencode-ai/schema/tool";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { WebSearch } from "@opencode-ai/schema/websearch";
|
|
2
|
-
import type { WebsearchApi } from "@opencode-ai/client/effect/api";
|
|
3
|
-
import type { Effect } from "effect";
|
|
4
|
-
import type { Transform } from "./registration.js";
|
|
5
|
-
export interface WebSearchDefinition {
|
|
6
|
-
readonly id: string;
|
|
7
|
-
readonly name: string;
|
|
8
|
-
readonly execute: (input: WebSearch.ProviderInput) => Effect.Effect<readonly WebSearch.Result[], unknown>;
|
|
9
|
-
}
|
|
10
|
-
export interface WebSearchDomain extends WebsearchApi<unknown> {
|
|
11
|
-
readonly transform: Transform<WebSearchDraft>;
|
|
12
|
-
readonly reload: () => Effect.Effect<void>;
|
|
13
|
-
}
|
|
14
|
-
export interface WebSearchDraft {
|
|
15
|
-
add(definition: WebSearchDefinition): void;
|
|
16
|
-
readonly default: {
|
|
17
|
-
get(): string | false | undefined;
|
|
18
|
-
set(selection: string | false): void;
|
|
19
|
-
};
|
|
20
|
-
}
|
package/dist/effect/websearch.js
DELETED
|
File without changes
|
package/dist/options.js
DELETED
|
File without changes
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Scope } from "effect";
|
|
2
|
-
import type { Plugin } from "./plugin.js";
|
|
3
|
-
/**
|
|
4
|
-
* Adapts a Promise plugin into an Effect plugin so the existing Effect-only
|
|
5
|
-
* loader (`Plugin` / `PluginSupervisor`) can run it unchanged.
|
|
6
|
-
*
|
|
7
|
-
* Hook registrations created during the async `setup` attach to the plugin's
|
|
8
|
-
* scope, so unloading the plugin disposes them. The captured fiber context
|
|
9
|
-
* preserves boot-time batching, so Promise-plugin transforms still coalesce
|
|
10
|
-
* into one reload per domain.
|
|
11
|
-
*/
|
|
12
|
-
export declare function fromPromise(plugin: Plugin): import("../effect/plugin.js").Plugin<Scope.Scope>;
|
package/dist/promise/adapter.js
DELETED
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import { Tool } from "@opencode-ai/schema/tool";
|
|
2
|
-
import { Effect, Schema, SchemaAST, Scope, Stream } from "effect";
|
|
3
|
-
import { HttpApiEndpoint, HttpApiSchema } from "effect/unstable/httpapi";
|
|
4
|
-
import { define } from "../effect/plugin.js";
|
|
5
|
-
const compiledEndpoints = new WeakMap();
|
|
6
|
-
function compileEndpoint(endpoint) {
|
|
7
|
-
const cached = compiledEndpoints.get(endpoint);
|
|
8
|
-
if (cached)
|
|
9
|
-
return cached;
|
|
10
|
-
const payloadSchemas = Array.from(endpoint.payload.values()).flatMap(({ schemas }) => schemas);
|
|
11
|
-
const successSchemas = Array.from(endpoint.success);
|
|
12
|
-
if (payloadSchemas.length > 1 || successSchemas.length > 1) {
|
|
13
|
-
throw new Error(`Unsupported API schema cardinality: ${endpoint.identifier}`);
|
|
14
|
-
}
|
|
15
|
-
const inputs = [
|
|
16
|
-
endpoint.params,
|
|
17
|
-
endpoint.query === undefined ? undefined : Schema.toType(endpoint.query),
|
|
18
|
-
endpoint.headers,
|
|
19
|
-
...payloadSchemas,
|
|
20
|
-
].filter((schema) => schema !== undefined);
|
|
21
|
-
const success = (successSchemas[0] ?? HttpApiSchema.NoContent);
|
|
22
|
-
const noContent = HttpApiSchema.isNoContent(success.ast);
|
|
23
|
-
const type = Schema.toType(success).ast;
|
|
24
|
-
const data = SchemaAST.isObjects(success.ast)
|
|
25
|
-
? success.ast.propertySignatures.find((property) => property.name === "data")
|
|
26
|
-
: undefined;
|
|
27
|
-
const output = !noContent &&
|
|
28
|
-
SchemaAST.isObjects(type) &&
|
|
29
|
-
type.indexSignatures.length === 0 &&
|
|
30
|
-
type.propertySignatures.length === 1 &&
|
|
31
|
-
type.propertySignatures[0]?.name === "data" &&
|
|
32
|
-
data !== undefined
|
|
33
|
-
? Schema.make(data.type)
|
|
34
|
-
: success;
|
|
35
|
-
const compiled = {
|
|
36
|
-
decode: inputs.map((schema) => Schema.decodeUnknownEffect(schema)),
|
|
37
|
-
encode: Schema.encodeUnknownEffect(output),
|
|
38
|
-
noContent,
|
|
39
|
-
};
|
|
40
|
-
compiledEndpoints.set(endpoint, compiled);
|
|
41
|
-
return compiled;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Adapts a Promise plugin into an Effect plugin so the existing Effect-only
|
|
45
|
-
* loader (`Plugin` / `PluginSupervisor`) can run it unchanged.
|
|
46
|
-
*
|
|
47
|
-
* Hook registrations created during the async `setup` attach to the plugin's
|
|
48
|
-
* scope, so unloading the plugin disposes them. The captured fiber context
|
|
49
|
-
* preserves boot-time batching, so Promise-plugin transforms still coalesce
|
|
50
|
-
* into one reload per domain.
|
|
51
|
-
*/
|
|
52
|
-
export function fromPromise(plugin) {
|
|
53
|
-
return define({
|
|
54
|
-
id: plugin.id,
|
|
55
|
-
tui: plugin.tui,
|
|
56
|
-
effect: (host) => Effect.gen(function* () {
|
|
57
|
-
const [{ ClientApi }, { OpenCodeEvent }] = yield* Effect.promise(() => Promise.all([import("@opencode-ai/protocol/client"), import("@opencode-ai/protocol/groups/event")]));
|
|
58
|
-
const AgentEndpoints = ClientApi.groups["server.agent"].endpoints;
|
|
59
|
-
const CommandEndpoints = ClientApi.groups["server.command"].endpoints;
|
|
60
|
-
const IntegrationEndpoints = ClientApi.groups["server.integration"].endpoints;
|
|
61
|
-
const McpEndpoints = ClientApi.groups["server.mcp"].endpoints;
|
|
62
|
-
const ModelEndpoints = ClientApi.groups["server.model"].endpoints;
|
|
63
|
-
const PluginEndpoints = ClientApi.groups["server.plugin"].endpoints;
|
|
64
|
-
const ProviderEndpoints = ClientApi.groups["server.provider"].endpoints;
|
|
65
|
-
const ReferenceEndpoints = ClientApi.groups["server.reference"].endpoints;
|
|
66
|
-
const SessionEndpoints = ClientApi.groups["server.session"].endpoints;
|
|
67
|
-
const SkillEndpoints = ClientApi.groups["server.skill"].endpoints;
|
|
68
|
-
const WebSearchEndpoints = ClientApi.groups["server.websearch"].endpoints;
|
|
69
|
-
const scope = yield* Scope.Scope;
|
|
70
|
-
const context = yield* Effect.context();
|
|
71
|
-
// Run a hook registration on the plugin scope and resolve once it is registered.
|
|
72
|
-
const register = (effect) => Effect.runPromiseWith(context)(Scope.provide(scope)(effect)).then((registration) => ({
|
|
73
|
-
dispose: () => Effect.runPromiseWith(context)(registration.dispose),
|
|
74
|
-
}));
|
|
75
|
-
const run = (effect) => Effect.runPromiseWith(context)(effect);
|
|
76
|
-
const adaptApiMethod = (endpoint, method) => {
|
|
77
|
-
const compiled = compileEndpoint(endpoint);
|
|
78
|
-
return ((input) => Effect.gen(function* () {
|
|
79
|
-
const decoded = yield* Effect.forEach(compiled.decode, (decode) => decode(input ?? {}));
|
|
80
|
-
const result = yield* method(Object.assign({}, ...decoded));
|
|
81
|
-
if (compiled.noContent)
|
|
82
|
-
return undefined;
|
|
83
|
-
return yield* compiled.encode(result);
|
|
84
|
-
}).pipe(Effect.runPromiseWith(context)));
|
|
85
|
-
};
|
|
86
|
-
const transform = (domain) => (callback) => register(domain.transform((draft) => {
|
|
87
|
-
callback(draft);
|
|
88
|
-
}));
|
|
89
|
-
const context2 = {
|
|
90
|
-
app: host.app,
|
|
91
|
-
options: host.options,
|
|
92
|
-
agent: {
|
|
93
|
-
get: adaptApiMethod(AgentEndpoints["agent.get"], host.agent.get),
|
|
94
|
-
list: adaptApiMethod(AgentEndpoints["agent.list"], host.agent.list),
|
|
95
|
-
transform: transform(host.agent),
|
|
96
|
-
reload: () => run(host.agent.reload()),
|
|
97
|
-
},
|
|
98
|
-
aisdk: {
|
|
99
|
-
hook: (name, callback, options) => register(host.aisdk.hook(name, (event) => Effect.promise(() => Promise.resolve(callback(event))), options)),
|
|
100
|
-
},
|
|
101
|
-
catalog: {
|
|
102
|
-
provider: {
|
|
103
|
-
list: adaptApiMethod(ProviderEndpoints["provider.list"], host.catalog.provider.list),
|
|
104
|
-
get: adaptApiMethod(ProviderEndpoints["provider.get"], host.catalog.provider.get),
|
|
105
|
-
},
|
|
106
|
-
model: {
|
|
107
|
-
list: adaptApiMethod(ModelEndpoints["model.list"], host.catalog.model.list),
|
|
108
|
-
default: adaptApiMethod(ModelEndpoints["model.default"], host.catalog.model.default),
|
|
109
|
-
},
|
|
110
|
-
transform: transform(host.catalog),
|
|
111
|
-
reload: () => run(host.catalog.reload()),
|
|
112
|
-
},
|
|
113
|
-
command: {
|
|
114
|
-
list: adaptApiMethod(CommandEndpoints["command.list"], host.command.list),
|
|
115
|
-
transform: transform(host.command),
|
|
116
|
-
reload: () => run(host.command.reload()),
|
|
117
|
-
},
|
|
118
|
-
event: {
|
|
119
|
-
subscribe: () => Stream.toAsyncIterable(host.event.subscribe().pipe(Stream.mapEffect((event) => Schema.encodeUnknownEffect(OpenCodeEvent)(event)), Stream.map((event) => event))),
|
|
120
|
-
},
|
|
121
|
-
integration: {
|
|
122
|
-
list: adaptApiMethod(IntegrationEndpoints["integration.list"], host.integration.list),
|
|
123
|
-
get: adaptApiMethod(IntegrationEndpoints["integration.get"], host.integration.get),
|
|
124
|
-
connect: {
|
|
125
|
-
key: adaptApiMethod(IntegrationEndpoints["integration.connect.key"], host.integration.connect.key),
|
|
126
|
-
},
|
|
127
|
-
oauth: {
|
|
128
|
-
connect: adaptApiMethod(IntegrationEndpoints["integration.oauth.connect"], host.integration.oauth.connect),
|
|
129
|
-
status: adaptApiMethod(IntegrationEndpoints["integration.oauth.status"], host.integration.oauth.status),
|
|
130
|
-
complete: adaptApiMethod(IntegrationEndpoints["integration.oauth.complete"], host.integration.oauth.complete),
|
|
131
|
-
cancel: adaptApiMethod(IntegrationEndpoints["integration.oauth.cancel"], host.integration.oauth.cancel),
|
|
132
|
-
},
|
|
133
|
-
command: {
|
|
134
|
-
connect: adaptApiMethod(IntegrationEndpoints["integration.command.connect"], host.integration.command.connect),
|
|
135
|
-
status: adaptApiMethod(IntegrationEndpoints["integration.command.status"], host.integration.command.status),
|
|
136
|
-
cancel: adaptApiMethod(IntegrationEndpoints["integration.command.cancel"], host.integration.command.cancel),
|
|
137
|
-
},
|
|
138
|
-
transform: (callback) => register(host.integration.transform((draft) => callback({
|
|
139
|
-
list: draft.list,
|
|
140
|
-
get: draft.get,
|
|
141
|
-
update: draft.update,
|
|
142
|
-
remove: draft.remove,
|
|
143
|
-
method: {
|
|
144
|
-
list: draft.method.list,
|
|
145
|
-
update: (input) => {
|
|
146
|
-
if (!("authorize" in input))
|
|
147
|
-
return draft.method.update(input);
|
|
148
|
-
const refresh = input.refresh;
|
|
149
|
-
draft.method.update({
|
|
150
|
-
...input,
|
|
151
|
-
authorize: (answer) => Effect.promise(() => input.authorize(answer)).pipe(Effect.map((authorization) => authorization.mode === "auto"
|
|
152
|
-
? {
|
|
153
|
-
...authorization,
|
|
154
|
-
callback: Effect.promise(() => authorization.callback),
|
|
155
|
-
}
|
|
156
|
-
: {
|
|
157
|
-
...authorization,
|
|
158
|
-
callback: (code) => Effect.promise(() => authorization.callback(code)),
|
|
159
|
-
})),
|
|
160
|
-
refresh: refresh === undefined
|
|
161
|
-
? undefined
|
|
162
|
-
: (credential) => Effect.promise(() => refresh(credential)),
|
|
163
|
-
});
|
|
164
|
-
},
|
|
165
|
-
remove: draft.method.remove,
|
|
166
|
-
},
|
|
167
|
-
}))),
|
|
168
|
-
reload: () => run(host.integration.reload()),
|
|
169
|
-
connection: {
|
|
170
|
-
active: (id) => Effect.runPromiseWith(context)(host.integration.connection.active(id)),
|
|
171
|
-
resolve: (connection) => Effect.runPromiseWith(context)(host.integration.connection.resolve(connection)),
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
mcp: {
|
|
175
|
-
list: adaptApiMethod(McpEndpoints["mcp.list"], host.mcp.list),
|
|
176
|
-
add: adaptApiMethod(McpEndpoints["mcp.add"], host.mcp.add),
|
|
177
|
-
remove: adaptApiMethod(McpEndpoints["mcp.remove"], host.mcp.remove),
|
|
178
|
-
connect: adaptApiMethod(McpEndpoints["mcp.connect"], host.mcp.connect),
|
|
179
|
-
disconnect: adaptApiMethod(McpEndpoints["mcp.disconnect"], host.mcp.disconnect),
|
|
180
|
-
transform: transform(host.mcp),
|
|
181
|
-
reload: () => run(host.mcp.reload()),
|
|
182
|
-
},
|
|
183
|
-
plugin: {
|
|
184
|
-
list: adaptApiMethod(PluginEndpoints["plugin.list"], host.plugin.list),
|
|
185
|
-
},
|
|
186
|
-
reference: {
|
|
187
|
-
list: adaptApiMethod(ReferenceEndpoints["reference.list"], host.reference.list),
|
|
188
|
-
transform: transform(host.reference),
|
|
189
|
-
reload: () => run(host.reference.reload()),
|
|
190
|
-
},
|
|
191
|
-
skill: {
|
|
192
|
-
list: adaptApiMethod(SkillEndpoints["skill.list"], host.skill.list),
|
|
193
|
-
transform: transform(host.skill),
|
|
194
|
-
reload: () => run(host.skill.reload()),
|
|
195
|
-
},
|
|
196
|
-
storage: {
|
|
197
|
-
get: (key) => run(host.storage.get(key)),
|
|
198
|
-
set: (key, value) => run(host.storage.set(key, value)),
|
|
199
|
-
remove: (key) => run(host.storage.remove(key)),
|
|
200
|
-
scan: (options) => run(host.storage.scan(options)),
|
|
201
|
-
},
|
|
202
|
-
tool: {
|
|
203
|
-
transform: (callback) => register(host.tool.transform((draft) => callback({
|
|
204
|
-
add: (tool) => draft.add({
|
|
205
|
-
...tool,
|
|
206
|
-
execute: (input, context) => executePromiseTool(tool, input, context),
|
|
207
|
-
}),
|
|
208
|
-
}))),
|
|
209
|
-
hook: (name, callback) => register(host.tool.hook(name, (event) => Effect.promise(() => Promise.resolve(callback(event))))),
|
|
210
|
-
},
|
|
211
|
-
websearch: {
|
|
212
|
-
providers: adaptApiMethod(WebSearchEndpoints["websearch.providers"], host.websearch.providers),
|
|
213
|
-
query: adaptApiMethod(WebSearchEndpoints["websearch.query"], host.websearch.query),
|
|
214
|
-
reload: () => run(host.websearch.reload()),
|
|
215
|
-
transform: (callback) => register(host.websearch.transform((draft) => {
|
|
216
|
-
callback({
|
|
217
|
-
add: (definition) => draft.add({
|
|
218
|
-
id: definition.id,
|
|
219
|
-
name: definition.name,
|
|
220
|
-
execute: (input) => attempt((signal) => definition.execute(input, { signal })),
|
|
221
|
-
}),
|
|
222
|
-
default: draft.default,
|
|
223
|
-
});
|
|
224
|
-
})),
|
|
225
|
-
},
|
|
226
|
-
session: {
|
|
227
|
-
hook: (name, callback, options) => register(host.session.hook(name, (event) => Effect.promise(() => Promise.resolve(callback(event))), options)),
|
|
228
|
-
create: adaptApiMethod(SessionEndpoints["session.create"], host.session.create),
|
|
229
|
-
get: adaptApiMethod(SessionEndpoints["session.get"], host.session.get),
|
|
230
|
-
switchAgent: adaptApiMethod(SessionEndpoints["session.switchAgent"], host.session.switchAgent),
|
|
231
|
-
switchModel: adaptApiMethod(SessionEndpoints["session.switchModel"], host.session.switchModel),
|
|
232
|
-
prompt: adaptApiMethod(SessionEndpoints["session.prompt"], host.session.prompt),
|
|
233
|
-
generate: adaptApiMethod(SessionEndpoints["session.generate"], host.session.generate),
|
|
234
|
-
command: adaptApiMethod(SessionEndpoints["session.command"], host.session.command),
|
|
235
|
-
synthetic: adaptApiMethod(SessionEndpoints["session.synthetic"], host.session.synthetic),
|
|
236
|
-
interrupt: adaptApiMethod(SessionEndpoints["session.interrupt"], host.session.interrupt),
|
|
237
|
-
rename: adaptApiMethod(SessionEndpoints["session.rename"], host.session.rename),
|
|
238
|
-
wait: adaptApiMethod(SessionEndpoints["session.wait"], host.session.wait),
|
|
239
|
-
},
|
|
240
|
-
shell: {
|
|
241
|
-
hook: (name, callback) => register(host.shell.hook(name, (event) => Effect.promise(() => Promise.resolve(callback(event))))),
|
|
242
|
-
},
|
|
243
|
-
};
|
|
244
|
-
const cleanup = yield* Effect.promise(() => Promise.resolve(plugin.setup(context2)));
|
|
245
|
-
if (!cleanup)
|
|
246
|
-
return;
|
|
247
|
-
yield* Effect.addFinalizer(() => Effect.promise(() => Promise.resolve(cleanup())));
|
|
248
|
-
}),
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
function attempt(evaluate) {
|
|
252
|
-
return Effect.tryPromise({ try: evaluate, catch: (cause) => cause });
|
|
253
|
-
}
|
|
254
|
-
const executePromiseTool = (tool, input, context) => Effect.promise(() => tool.execute(input, {
|
|
255
|
-
...context,
|
|
256
|
-
progress: (update) => Effect.runPromise(context.progress(update)),
|
|
257
|
-
}));
|
package/dist/promise/agent.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { AgentApi } from "@opencode-ai/client/promise/api";
|
|
2
|
-
import type { Agent } from "@opencode-ai/schema/agent";
|
|
3
|
-
import type { Transform } from "./registration.js";
|
|
4
|
-
import type { DeepMutable } from "./types.js";
|
|
5
|
-
export interface AgentDraft {
|
|
6
|
-
list(): readonly DeepMutable<Agent.Info>[];
|
|
7
|
-
get(id: string): DeepMutable<Agent.Info> | undefined;
|
|
8
|
-
default(id: string | undefined): void;
|
|
9
|
-
update(id: string, update: (agent: DeepMutable<Agent.Info>) => void): void;
|
|
10
|
-
remove(id: string): void;
|
|
11
|
-
}
|
|
12
|
-
export interface AgentDomain extends AgentApi {
|
|
13
|
-
readonly transform: Transform<AgentDraft>;
|
|
14
|
-
readonly reload: () => Promise<void>;
|
|
15
|
-
}
|
package/dist/promise/agent.js
DELETED
|
File without changes
|
package/dist/promise/aisdk.js
DELETED
|
File without changes
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { CatalogApi } from "@opencode-ai/client/promise/api";
|
|
2
|
-
import type { Model } from "@opencode-ai/schema/model";
|
|
3
|
-
import type { Provider } from "@opencode-ai/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 CatalogDraft {
|
|
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<CatalogDraft>;
|
|
32
|
-
readonly reload: () => Promise<void>;
|
|
33
|
-
}
|
package/dist/promise/catalog.js
DELETED
|
File without changes
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { CommandApi } from "@opencode-ai/client/promise/api";
|
|
2
|
-
import type { CommandInfo } from "@opencode-ai/client";
|
|
3
|
-
import type { Transform } from "./registration.js";
|
|
4
|
-
export interface CommandDraft {
|
|
5
|
-
list(): readonly CommandInfo[];
|
|
6
|
-
get(name: string): CommandInfo | undefined;
|
|
7
|
-
update(name: string, update: (command: CommandInfo) => void): void;
|
|
8
|
-
remove(name: string): void;
|
|
9
|
-
}
|
|
10
|
-
export interface CommandDomain extends CommandApi {
|
|
11
|
-
readonly transform: Transform<CommandDraft>;
|
|
12
|
-
readonly reload: () => Promise<void>;
|
|
13
|
-
}
|
package/dist/promise/command.js
DELETED
|
File without changes
|
package/dist/promise/event.d.ts
DELETED
package/dist/promise/event.js
DELETED
|
File without changes
|
package/dist/promise/index.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type { PluginOptions } from "../options.js";
|
|
2
|
-
export type { StorageEntry, StorageScanOptions, StorageScanResult } from "../storage.js";
|
|
3
|
-
export * as Plugin from "./plugin.js";
|
|
4
|
-
export { Agent } from "@opencode-ai/schema/agent";
|
|
5
|
-
export { Command } from "@opencode-ai/schema/command";
|
|
6
|
-
export { Connection } from "@opencode-ai/schema/connection";
|
|
7
|
-
export { Credential } from "@opencode-ai/schema/credential";
|
|
8
|
-
export { Integration } from "@opencode-ai/schema/integration";
|
|
9
|
-
export { Mcp } from "@opencode-ai/schema/mcp";
|
|
10
|
-
export { Model } from "@opencode-ai/schema/model";
|
|
11
|
-
export { Provider } from "@opencode-ai/schema/provider";
|
|
12
|
-
export { Reference } from "@opencode-ai/schema/reference";
|
|
13
|
-
export { Skill } from "@opencode-ai/schema/skill";
|
|
14
|
-
export { WebSearch } from "@opencode-ai/schema/websearch";
|