@opencode-ai/plugin 0.0.0-dev-202608272023 → 0.0.0-dev-18430

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.
Files changed (159) hide show
  1. package/dist/app.d.ts +5 -0
  2. package/dist/app.js +0 -0
  3. package/dist/effect/agent.d.ts +15 -0
  4. package/dist/effect/agent.js +0 -0
  5. package/dist/{v2/promise → effect}/aisdk.d.ts +9 -6
  6. package/dist/effect/aisdk.js +0 -0
  7. package/dist/effect/catalog.d.ts +33 -0
  8. package/dist/effect/catalog.js +2 -0
  9. package/dist/effect/command.d.ts +23 -0
  10. package/dist/effect/command.js +0 -0
  11. package/dist/effect/event.d.ts +3 -0
  12. package/dist/effect/event.js +0 -0
  13. package/dist/effect/index.d.ts +15 -0
  14. package/dist/effect/index.js +14 -0
  15. package/dist/effect/integration.d.ts +80 -0
  16. package/dist/effect/integration.js +2 -0
  17. package/dist/effect/mcp.d.ts +15 -0
  18. package/dist/effect/mcp.js +0 -0
  19. package/dist/effect/permission.d.ts +21 -0
  20. package/dist/effect/permission.js +0 -0
  21. package/dist/effect/plugin.d.ts +52 -0
  22. package/dist/effect/reference.d.ts +13 -0
  23. package/dist/effect/reference.js +0 -0
  24. package/dist/effect/registration.d.ts +13 -0
  25. package/dist/effect/registration.js +0 -0
  26. package/dist/effect/session.d.ts +61 -0
  27. package/dist/effect/session.js +0 -0
  28. package/dist/effect/shell.d.ts +14 -0
  29. package/dist/effect/shell.js +0 -0
  30. package/dist/effect/skill.d.ts +14 -0
  31. package/dist/effect/skill.js +1 -0
  32. package/dist/effect/storage.d.ts +8 -0
  33. package/dist/effect/storage.js +0 -0
  34. package/dist/effect/tool.d.ts +51 -0
  35. package/dist/effect/tool.js +1 -0
  36. package/dist/effect/vcs.d.ts +39 -0
  37. package/dist/effect/vcs.js +0 -0
  38. package/dist/effect/websearch.d.ts +20 -0
  39. package/dist/effect/websearch.js +0 -0
  40. package/dist/options.js +0 -0
  41. package/dist/promise/adapter.d.ts +12 -0
  42. package/dist/promise/adapter.js +313 -0
  43. package/dist/promise/agent.d.ts +15 -0
  44. package/dist/promise/agent.js +0 -0
  45. package/dist/{v2/effect → promise}/aisdk.d.ts +9 -6
  46. package/dist/promise/aisdk.js +0 -0
  47. package/dist/promise/catalog.d.ts +33 -0
  48. package/dist/promise/catalog.js +0 -0
  49. package/dist/promise/command.d.ts +22 -0
  50. package/dist/promise/command.js +0 -0
  51. package/dist/promise/event.d.ts +3 -0
  52. package/dist/promise/event.js +0 -0
  53. package/dist/promise/index.d.ts +16 -0
  54. package/dist/promise/index.js +14 -0
  55. package/dist/promise/integration.d.ts +79 -0
  56. package/dist/promise/integration.js +2 -0
  57. package/dist/promise/mcp.d.ts +15 -0
  58. package/dist/promise/mcp.js +0 -0
  59. package/dist/promise/permission.d.ts +21 -0
  60. package/dist/promise/permission.js +0 -0
  61. package/dist/promise/plugin.d.ts +52 -0
  62. package/dist/{v2/effect → promise}/reference.d.ts +7 -5
  63. package/dist/promise/reference.js +0 -0
  64. package/dist/promise/registration.d.ts +12 -0
  65. package/dist/promise/registration.js +0 -0
  66. package/dist/promise/session.d.ts +61 -0
  67. package/dist/promise/session.js +0 -0
  68. package/dist/promise/shell.d.ts +14 -0
  69. package/dist/promise/shell.js +0 -0
  70. package/dist/promise/skill.d.ts +14 -0
  71. package/dist/promise/skill.js +0 -0
  72. package/dist/promise/storage.d.ts +8 -0
  73. package/dist/promise/storage.js +0 -0
  74. package/dist/promise/tool.d.ts +55 -0
  75. package/dist/promise/tool.js +2 -0
  76. package/dist/promise/types.d.ts +3 -0
  77. package/dist/promise/types.js +0 -0
  78. package/dist/promise/vcs.d.ts +46 -0
  79. package/dist/promise/vcs.js +0 -0
  80. package/dist/promise/websearch.d.ts +21 -0
  81. package/dist/promise/websearch.js +0 -0
  82. package/dist/storage.d.ts +14 -0
  83. package/dist/storage.js +0 -0
  84. package/dist/tui/context.d.ts +424 -0
  85. package/dist/tui/context.js +0 -0
  86. package/dist/tui/index.d.ts +2 -0
  87. package/dist/tui/index.js +2 -0
  88. package/dist/tui/plugin.d.ts +8 -0
  89. package/dist/tui/plugin.js +3 -0
  90. package/dist/tui/solid.d.ts +7 -0
  91. package/dist/tui/solid.js +16 -0
  92. package/dist/vcs.d.ts +4 -0
  93. package/dist/vcs.js +0 -0
  94. package/package.json +33 -34
  95. package/dist/example-workspace.d.ts +0 -3
  96. package/dist/example-workspace.js +0 -30
  97. package/dist/example.d.ts +0 -2
  98. package/dist/example.js +0 -16
  99. package/dist/index.d.ts +0 -322
  100. package/dist/index.js +0 -1
  101. package/dist/shell.d.ts +0 -109
  102. package/dist/shell.js +0 -1
  103. package/dist/tool.d.ts +0 -60
  104. package/dist/tool.js +0 -5
  105. package/dist/tui.d.ts +0 -510
  106. package/dist/tui.js +0 -7
  107. package/dist/v2/effect/agent.d.ts +0 -12
  108. package/dist/v2/effect/agent.js +0 -1
  109. package/dist/v2/effect/aisdk.js +0 -1
  110. package/dist/v2/effect/catalog.d.ts +0 -29
  111. package/dist/v2/effect/catalog.js +0 -1
  112. package/dist/v2/effect/command.d.ts +0 -11
  113. package/dist/v2/effect/command.js +0 -1
  114. package/dist/v2/effect/context.d.ts +0 -21
  115. package/dist/v2/effect/context.js +0 -1
  116. package/dist/v2/effect/event.d.ts +0 -8
  117. package/dist/v2/effect/event.js +0 -1
  118. package/dist/v2/effect/filesystem.d.ts +0 -23
  119. package/dist/v2/effect/filesystem.js +0 -1
  120. package/dist/v2/effect/index.d.ts +0 -3
  121. package/dist/v2/effect/index.js +0 -1
  122. package/dist/v2/effect/integration.d.ts +0 -46
  123. package/dist/v2/effect/integration.js +0 -1
  124. package/dist/v2/effect/location.d.ts +0 -6
  125. package/dist/v2/effect/location.js +0 -1
  126. package/dist/v2/effect/npm.d.ts +0 -7
  127. package/dist/v2/effect/npm.js +0 -1
  128. package/dist/v2/effect/path.d.ts +0 -8
  129. package/dist/v2/effect/path.js +0 -1
  130. package/dist/v2/effect/plugin.d.ts +0 -11
  131. package/dist/v2/effect/reference.js +0 -1
  132. package/dist/v2/effect/registration.d.ts +0 -10
  133. package/dist/v2/effect/registration.js +0 -1
  134. package/dist/v2/effect/skill.d.ts +0 -9
  135. package/dist/v2/effect/skill.js +0 -1
  136. package/dist/v2/options.js +0 -1
  137. package/dist/v2/promise/agent.d.ts +0 -6
  138. package/dist/v2/promise/agent.js +0 -1
  139. package/dist/v2/promise/aisdk.js +0 -1
  140. package/dist/v2/promise/catalog.d.ts +0 -6
  141. package/dist/v2/promise/catalog.js +0 -1
  142. package/dist/v2/promise/command.d.ts +0 -6
  143. package/dist/v2/promise/command.js +0 -1
  144. package/dist/v2/promise/context.d.ts +0 -21
  145. package/dist/v2/promise/context.js +0 -1
  146. package/dist/v2/promise/index.d.ts +0 -12
  147. package/dist/v2/promise/index.js +0 -1
  148. package/dist/v2/promise/integration.d.ts +0 -12
  149. package/dist/v2/promise/integration.js +0 -1
  150. package/dist/v2/promise/plugin.d.ts +0 -10
  151. package/dist/v2/promise/reference.d.ts +0 -6
  152. package/dist/v2/promise/reference.js +0 -1
  153. package/dist/v2/promise/registration.d.ts +0 -9
  154. package/dist/v2/promise/registration.js +0 -1
  155. package/dist/v2/promise/skill.d.ts +0 -6
  156. package/dist/v2/promise/skill.js +0 -1
  157. /package/dist/{v2/effect → effect}/plugin.js +0 -0
  158. /package/dist/{v2/options.d.ts → options.d.ts} +0 -0
  159. /package/dist/{v2/promise → promise}/plugin.js +0 -0
package/dist/app.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export interface App {
2
+ readonly name: string;
3
+ readonly version: string;
4
+ readonly channel: string;
5
+ }
package/dist/app.js ADDED
File without changes
@@ -0,0 +1,15 @@
1
+ import type { AgentApi } from "@opencode-ai/client/effect/api";
2
+ import type { Agent } from "@opencode-ai/schema/agent";
3
+ import type { Effect, Types } from "effect";
4
+ import type { Transform } from "./registration.js";
5
+ export interface AgentDraft {
6
+ list(): readonly Types.DeepMutable<Agent.Info>[];
7
+ get(id: string): Types.DeepMutable<Agent.Info> | undefined;
8
+ default(id: string | undefined): void;
9
+ update(id: string, update: (agent: Types.DeepMutable<Agent.Info>) => void): void;
10
+ remove(id: string): void;
11
+ }
12
+ export interface AgentDomain extends AgentApi<unknown> {
13
+ readonly transform: Transform<AgentDraft>;
14
+ readonly reload: () => Effect.Effect<void>;
15
+ }
File without changes
@@ -1,17 +1,20 @@
1
1
  import type { LanguageModelV3 } from "@ai-sdk/provider";
2
- import type { ModelV2Info } from "@opencode-ai/sdk/v2/types";
3
- import type { Hooks } from "./registration.js";
4
- export type AISDKHooks = Hooks<{
2
+ import type { Model } from "@opencode-ai/schema/model";
3
+ import type { ModelHooks } from "./registration.js";
4
+ export interface AISDKHooks {
5
5
  sdk: {
6
- readonly model: ModelV2Info;
6
+ readonly model: Model.Info;
7
7
  readonly package: string;
8
8
  readonly options: Record<string, any>;
9
9
  sdk?: any;
10
10
  };
11
11
  language: {
12
- readonly model: ModelV2Info;
12
+ readonly model: Model.Info;
13
13
  readonly sdk: any;
14
14
  readonly options: Record<string, any>;
15
15
  language?: LanguageModelV3;
16
16
  };
17
- }>;
17
+ }
18
+ export interface AISDKDomain {
19
+ readonly hook: ModelHooks<AISDKHooks>;
20
+ }
File without changes
@@ -0,0 +1,33 @@
1
+ import type { CatalogApi } from "@opencode-ai/client/effect/api";
2
+ import { Model } from "@opencode-ai/schema/model";
3
+ import { Provider } from "@opencode-ai/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 CatalogDraft {
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<CatalogDraft>;
32
+ readonly reload: () => Effect.Effect<void>;
33
+ }
@@ -0,0 +1,2 @@
1
+ import { Model } from "@opencode-ai/schema/model";
2
+ import { Provider } from "@opencode-ai/schema/provider";
@@ -0,0 +1,23 @@
1
+ import type { CommandApi } from "@opencode-ai/client/effect/api";
2
+ import type { PromptInput } from "@opencode-ai/schema/prompt-input";
3
+ import type { Session } from "@opencode-ai/schema/session";
4
+ import type { SessionInbox } from "@opencode-ai/schema/session-inbox";
5
+ import type { Effect } from "effect";
6
+ import type { Transform } from "./registration.js";
7
+ export interface CommandInvocation {
8
+ readonly sessionID: Session.ID;
9
+ readonly prompt: PromptInput.Prompt;
10
+ readonly delivery: SessionInbox.Delivery;
11
+ }
12
+ export interface CommandDefinition {
13
+ readonly name: string;
14
+ readonly description?: string;
15
+ readonly execute: (input: CommandInvocation) => Effect.Effect<void, unknown>;
16
+ }
17
+ export interface CommandDraft {
18
+ add(definition: CommandDefinition): void;
19
+ }
20
+ export interface CommandDomain extends Pick<CommandApi<unknown>, "list"> {
21
+ readonly transform: Transform<CommandDraft>;
22
+ readonly reload: () => Effect.Effect<void>;
23
+ }
File without changes
@@ -0,0 +1,3 @@
1
+ import type { EventApi } from "@opencode-ai/client/effect/api";
2
+ export interface EventDomain extends Pick<EventApi<unknown>, "subscribe"> {
3
+ }
File without changes
@@ -0,0 +1,15 @@
1
+ export * as Plugin from "./plugin.js";
2
+ export type { StorageEntry, StorageScanOptions, StorageScanResult } from "../storage.js";
3
+ export { Agent } from "@opencode-ai/schema/agent";
4
+ export { Command } from "@opencode-ai/schema/command";
5
+ export { Connection } from "@opencode-ai/schema/connection";
6
+ export { Credential } from "@opencode-ai/schema/credential";
7
+ export { Integration } from "@opencode-ai/schema/integration";
8
+ export { Location } from "@opencode-ai/schema/location";
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 { Vcs } from "@opencode-ai/schema/vcs";
15
+ export { WebSearch } from "@opencode-ai/schema/websearch";
@@ -0,0 +1,14 @@
1
+ export * as Plugin from "./plugin.js";
2
+ export { Agent } from "@opencode-ai/schema/agent";
3
+ export { Command } from "@opencode-ai/schema/command";
4
+ export { Connection } from "@opencode-ai/schema/connection";
5
+ export { Credential } from "@opencode-ai/schema/credential";
6
+ export { Integration } from "@opencode-ai/schema/integration";
7
+ export { Location } from "@opencode-ai/schema/location";
8
+ export { Mcp } from "@opencode-ai/schema/mcp";
9
+ export { Model } from "@opencode-ai/schema/model";
10
+ export { Provider } from "@opencode-ai/schema/provider";
11
+ export { Reference } from "@opencode-ai/schema/reference";
12
+ export { Skill } from "@opencode-ai/schema/skill";
13
+ export { Vcs } from "@opencode-ai/schema/vcs";
14
+ export { WebSearch } from "@opencode-ai/schema/websearch";
@@ -0,0 +1,80 @@
1
+ import type { ConnectionInfo } from "@opencode-ai/client";
2
+ import type { IntegrationApi } from "@opencode-ai/client/effect/api";
3
+ import { Credential } from "@opencode-ai/schema/credential";
4
+ import { Form } from "@opencode-ai/schema/form";
5
+ import type { Effect, Scope } from "effect";
6
+ import type { Transform } from "./registration.js";
7
+ type IntegrationRef = {
8
+ id: string;
9
+ name: string;
10
+ };
11
+ export interface IntegrationOAuthMethod {
12
+ readonly id: string;
13
+ readonly type: "oauth";
14
+ readonly label: string;
15
+ readonly form?: Form.Fields;
16
+ }
17
+ export interface IntegrationCommandMethod {
18
+ readonly id: string;
19
+ readonly type: "command";
20
+ readonly label: string;
21
+ readonly command: ReadonlyArray<string>;
22
+ }
23
+ export interface IntegrationKeyMethod {
24
+ readonly type: "key";
25
+ readonly label?: string;
26
+ readonly form?: Form.Fields;
27
+ }
28
+ export interface IntegrationEnvMethod {
29
+ readonly type: "env";
30
+ readonly names: ReadonlyArray<string>;
31
+ }
32
+ export type IntegrationMethod = IntegrationOAuthMethod | IntegrationCommandMethod | IntegrationKeyMethod | IntegrationEnvMethod;
33
+ export type IntegrationOAuthAuthorization = {
34
+ readonly url: string;
35
+ readonly instructions: string;
36
+ readonly expiresAt?: number;
37
+ } & ({
38
+ readonly mode: "auto";
39
+ readonly callback: Effect.Effect<Credential.OAuth, unknown>;
40
+ } | {
41
+ readonly mode: "code";
42
+ readonly callback: (code: string) => Effect.Effect<Credential.OAuth, unknown>;
43
+ });
44
+ export type IntegrationOAuthMethodRegistration = {
45
+ readonly integrationID: string;
46
+ readonly method: IntegrationOAuthMethod;
47
+ readonly authorize: (answer: Form.Answer) => Effect.Effect<IntegrationOAuthAuthorization, unknown, Scope.Scope>;
48
+ readonly refresh?: (credential: Credential.OAuth) => Effect.Effect<Credential.OAuth, unknown>;
49
+ readonly label?: (credential: Credential.OAuth) => string | undefined;
50
+ };
51
+ export type IntegrationMethodRegistration = IntegrationOAuthMethodRegistration | {
52
+ readonly integrationID: string;
53
+ readonly method: IntegrationCommandMethod;
54
+ } | {
55
+ readonly integrationID: string;
56
+ readonly method: IntegrationKeyMethod;
57
+ } | {
58
+ readonly integrationID: string;
59
+ readonly method: IntegrationEnvMethod;
60
+ };
61
+ export interface IntegrationDraft {
62
+ list(): readonly IntegrationRef[];
63
+ get(id: string): IntegrationRef | undefined;
64
+ update(id: string, update: (integration: IntegrationRef) => void): void;
65
+ remove(id: string): void;
66
+ readonly method: {
67
+ list(integrationID: string): readonly IntegrationMethod[];
68
+ update(input: IntegrationMethodRegistration): void;
69
+ remove(integrationID: string, method: IntegrationMethod): void;
70
+ };
71
+ }
72
+ export interface IntegrationDomain extends Omit<IntegrationApi<unknown>, "wellknown"> {
73
+ readonly transform: Transform<IntegrationDraft>;
74
+ readonly reload: () => Effect.Effect<void>;
75
+ readonly connection: {
76
+ readonly active: (integrationID: string) => Effect.Effect<ConnectionInfo | undefined>;
77
+ readonly resolve: (connection: ConnectionInfo) => Effect.Effect<Credential.Value | undefined, unknown>;
78
+ };
79
+ }
80
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Credential } from "@opencode-ai/schema/credential";
2
+ import { Form } from "@opencode-ai/schema/form";
@@ -0,0 +1,15 @@
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 Pick<McpApi<unknown>, "list"> {
13
+ readonly transform: Transform<MCPDraft>;
14
+ readonly reload: () => Effect.Effect<void>;
15
+ }
File without changes
@@ -0,0 +1,21 @@
1
+ import type { PermissionApi } from "@opencode-ai/client/effect/api";
2
+ import type { Agent } from "@opencode-ai/schema/agent";
3
+ import type { Permission } from "@opencode-ai/schema/permission";
4
+ import type { Session } from "@opencode-ai/schema/session";
5
+ import type { Hooks } from "./registration.js";
6
+ export interface PermissionEvaluation {
7
+ readonly sessionID: Session.ID;
8
+ readonly agent?: Agent.ID;
9
+ readonly action: string;
10
+ readonly resources: ReadonlyArray<string>;
11
+ readonly metadata?: Record<string, unknown>;
12
+ readonly source?: Permission.Source;
13
+ effect: Permission.Effect;
14
+ message?: string;
15
+ }
16
+ export interface PermissionHooks {
17
+ readonly evaluate: PermissionEvaluation;
18
+ }
19
+ export type PermissionDomain = Pick<PermissionApi<unknown>, "list" | "get" | "reply"> & {
20
+ readonly hook: Hooks<PermissionHooks>;
21
+ };
File without changes
@@ -0,0 +1,52 @@
1
+ import type { GenerateApi, PluginApi } from "@opencode-ai/client/effect/api";
2
+ import type { Location } from "@opencode-ai/schema/location";
3
+ import type { Effect, Scope } from "effect";
4
+ import type { PluginOptions } from "../options.js";
5
+ import type { VcsDiscovery } from "../vcs.js";
6
+ import type { App } from "../app.js";
7
+ import type { AgentDomain } from "./agent.js";
8
+ import type { AISDKDomain } from "./aisdk.js";
9
+ import type { CatalogDomain } from "./catalog.js";
10
+ import type { CommandDomain } from "./command.js";
11
+ import type { EventDomain } from "./event.js";
12
+ import type { IntegrationDomain } from "./integration.js";
13
+ import type { MCPDomain } from "./mcp.js";
14
+ import type { PermissionDomain } from "./permission.js";
15
+ import type { ReferenceDomain } from "./reference.js";
16
+ import type { SessionDomain } from "./session.js";
17
+ import type { ShellDomain } from "./shell.js";
18
+ import type { SkillDomain } from "./skill.js";
19
+ import type { StorageDomain } from "./storage.js";
20
+ import type { ToolDomain } from "./tool.js";
21
+ import type { VcsDomain } from "./vcs.js";
22
+ import type { WebSearchDomain } from "./websearch.js";
23
+ export interface Context {
24
+ readonly app: App;
25
+ readonly location: Location.Info;
26
+ readonly options: PluginOptions;
27
+ readonly agent: AgentDomain;
28
+ readonly aisdk: AISDKDomain;
29
+ readonly catalog: CatalogDomain;
30
+ readonly command: CommandDomain;
31
+ readonly event: EventDomain;
32
+ readonly integration: IntegrationDomain;
33
+ readonly mcp: MCPDomain;
34
+ readonly generate: GenerateApi<unknown>;
35
+ readonly permission: PermissionDomain;
36
+ readonly plugin: PluginApi<unknown>;
37
+ readonly reference: ReferenceDomain;
38
+ readonly session: SessionDomain;
39
+ readonly shell: ShellDomain;
40
+ readonly skill: SkillDomain;
41
+ readonly storage: StorageDomain;
42
+ readonly tool: ToolDomain;
43
+ readonly vcs: VcsDomain;
44
+ readonly websearch: WebSearchDomain;
45
+ }
46
+ export interface Plugin<R = Scope.Scope> {
47
+ readonly id: string;
48
+ readonly tui?: boolean;
49
+ readonly vcs?: VcsDiscovery;
50
+ readonly effect: (context: Context) => Effect.Effect<void, never, R>;
51
+ }
52
+ export declare function define<R = Scope.Scope>(plugin: Plugin<R>): Plugin<R>;
@@ -0,0 +1,13 @@
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
+ }
File without changes
@@ -0,0 +1,13 @@
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?: Spec[Name] extends {
11
+ readonly model: unknown;
12
+ } ? ModelHookOptions : never) => Effect.Effect<Registration, never, Scope.Scope>;
13
+ export type Transform<Input> = (callback: (input: Input) => void) => Effect.Effect<Registration, never, Scope.Scope>;
File without changes
@@ -0,0 +1,61 @@
1
+ import type { SessionApi } from "@opencode-ai/client/effect/api";
2
+ import type { GenerationOptionsFields, 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 { PromptInput } from "@opencode-ai/schema/prompt-input";
6
+ import type { Session } from "@opencode-ai/schema/session";
7
+ import type { SessionInbox } from "@opencode-ai/schema/session-inbox";
8
+ import type { SessionMessage } from "@opencode-ai/schema/session-message";
9
+ import type { JsonSchema, Types } from "effect";
10
+ import type { ModelHooks } from "./registration.js";
11
+ export interface SessionPrompt {
12
+ readonly sessionID: Session.ID;
13
+ readonly messageID: SessionMessage.ID;
14
+ prompt: Types.DeepMutable<PromptInput.Prompt>;
15
+ metadata?: Record<string, unknown>;
16
+ delivery: SessionInbox.Delivery;
17
+ }
18
+ export interface SessionContext {
19
+ readonly sessionID: Session.ID;
20
+ readonly agent: Agent.ID;
21
+ readonly model: Model.Ref;
22
+ system: Array<SystemPart>;
23
+ messages: Array<Message>;
24
+ tools: Record<string, {
25
+ description: string;
26
+ input: JsonSchema.JsonSchema;
27
+ }>;
28
+ /** Request overrides; unset fields retain route and model defaults. */
29
+ generation: Types.DeepMutable<GenerationOptionsFields>;
30
+ providerOptions: Record<string, unknown>;
31
+ }
32
+ export interface SessionModelRequest {
33
+ readonly sessionID: Session.ID;
34
+ readonly agent: Agent.ID;
35
+ readonly model: Model.Ref;
36
+ baseURL?: string;
37
+ headers: Record<string, string>;
38
+ }
39
+ export interface SessionHttpRequest {
40
+ readonly sessionID: Session.ID;
41
+ readonly agent: Agent.ID;
42
+ readonly model: Model.Ref;
43
+ request: Request;
44
+ }
45
+ export interface SessionHttpResponse {
46
+ readonly sessionID: Session.ID;
47
+ readonly agent: Agent.ID;
48
+ readonly model: Model.Ref;
49
+ readonly request: Request;
50
+ response: Response;
51
+ }
52
+ export interface SessionHooks {
53
+ readonly prompt: SessionPrompt;
54
+ readonly context: SessionContext;
55
+ readonly "model.request": SessionModelRequest;
56
+ readonly "http.request": SessionHttpRequest;
57
+ readonly "http.response": SessionHttpResponse;
58
+ }
59
+ export type SessionDomain = Pick<SessionApi<unknown>, "create" | "get" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "synthetic" | "interrupt" | "rename" | "move" | "wait" | "context"> & {
60
+ readonly hook: ModelHooks<SessionHooks>;
61
+ };
File without changes
@@ -0,0 +1,14 @@
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
+ }
File without changes
@@ -0,0 +1,14 @@
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
+ }
@@ -0,0 +1 @@
1
+ import { Skill } from "@opencode-ai/schema/skill";
@@ -0,0 +1,8 @@
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
+ }
File without changes
@@ -0,0 +1,51 @@
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 { Effect, Types } from "effect";
6
+ import type { Hooks, Transform } from "./registration.js";
7
+ export interface ToolDraft {
8
+ list(): readonly (Tool.Info & {
9
+ readonly id: string;
10
+ })[];
11
+ get(id: string): (Tool.Info & {
12
+ readonly id: string;
13
+ }) | undefined;
14
+ add<Input extends Tool.ValueSchema<any>, Output extends Tool.ValueSchema<any> | undefined>(tool: Tool.Info<Input, Output>): void;
15
+ /** Updates an existing tool; missing IDs are ignored. */
16
+ update(id: string, update: (tool: Types.Mutable<Tool.Info>) => void): void;
17
+ remove(id: string): void;
18
+ }
19
+ export interface ToolHooks {
20
+ readonly "execute.before": {
21
+ tool: string;
22
+ readonly sessionID: Session.ID;
23
+ readonly agent: Agent.ID;
24
+ readonly messageID: SessionMessage.ID;
25
+ readonly id: Tool.CallID;
26
+ input: unknown;
27
+ };
28
+ readonly "execute.after": {
29
+ readonly tool: string;
30
+ readonly sessionID: Session.ID;
31
+ readonly agent: Agent.ID;
32
+ readonly messageID: SessionMessage.ID;
33
+ readonly id: Tool.CallID;
34
+ readonly input: unknown;
35
+ } & ({
36
+ readonly status: "completed";
37
+ result: Tool.Result;
38
+ } | {
39
+ readonly status: "error";
40
+ error: Tool.Error;
41
+ });
42
+ }
43
+ export interface ToolFailures extends Record<keyof ToolHooks, unknown> {
44
+ readonly "execute.before": Tool.Error;
45
+ readonly "execute.after": never;
46
+ }
47
+ export interface ToolDomain {
48
+ readonly transform: Transform<ToolDraft>;
49
+ readonly reload: () => Effect.Effect<void>;
50
+ readonly hook: Hooks<ToolHooks, ToolFailures>;
51
+ }
@@ -0,0 +1 @@
1
+ import { Tool } from "@opencode-ai/schema/tool";
@@ -0,0 +1,39 @@
1
+ import type { VcsApi } from "@opencode-ai/client/effect/api";
2
+ import type { FileDiff } from "@opencode-ai/schema/file-diff";
3
+ import type { Vcs } from "@opencode-ai/schema/vcs";
4
+ import type { Effect } from "effect";
5
+ import type { Transform } from "./registration.js";
6
+ export interface VcsScope {
7
+ readonly directory: string;
8
+ readonly worktree: string;
9
+ readonly canonical: string;
10
+ readonly store?: string;
11
+ }
12
+ export interface VcsBranchesInput extends VcsScope {
13
+ readonly search?: string;
14
+ readonly limit?: number;
15
+ }
16
+ export interface VcsDiffInput extends VcsScope {
17
+ readonly mode: Vcs.Mode;
18
+ readonly context: number;
19
+ readonly maxOutputBytes: number;
20
+ }
21
+ export interface VcsDefinition {
22
+ readonly id: string;
23
+ readonly name: string;
24
+ readonly info: (input: VcsScope) => Effect.Effect<Vcs.Info, unknown>;
25
+ readonly branches: (input: VcsBranchesInput) => Effect.Effect<Vcs.BranchList, unknown>;
26
+ readonly status: (input: VcsScope) => Effect.Effect<readonly Vcs.FileStatus[], unknown>;
27
+ readonly diff: (input: VcsDiffInput) => Effect.Effect<readonly FileDiff.Info[], unknown>;
28
+ }
29
+ export interface VcsDomain extends VcsApi<unknown> {
30
+ readonly transform: Transform<VcsDraft>;
31
+ readonly reload: () => Effect.Effect<void>;
32
+ }
33
+ export interface VcsDraft {
34
+ add(definition: VcsDefinition): void;
35
+ readonly default: {
36
+ get(): string | undefined;
37
+ set(selection: string): void;
38
+ };
39
+ }
File without changes
@@ -0,0 +1,20 @@
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
+ }
File without changes
File without changes
@@ -0,0 +1,12 @@
1
+ import type { 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>;