@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.
Files changed (149) hide show
  1. package/dist/example-workspace.d.ts +3 -0
  2. package/dist/example-workspace.js +30 -0
  3. package/dist/example.d.ts +2 -0
  4. package/dist/example.js +16 -0
  5. package/dist/index.d.ts +322 -0
  6. package/dist/index.js +1 -0
  7. package/dist/shell.d.ts +109 -0
  8. package/dist/shell.js +1 -0
  9. package/dist/tool.d.ts +60 -0
  10. package/dist/tool.js +5 -0
  11. package/dist/tui.d.ts +510 -0
  12. package/dist/tui.js +7 -0
  13. package/dist/v2/effect/agent.d.ts +12 -0
  14. package/dist/v2/effect/agent.js +1 -0
  15. package/dist/{effect → v2/effect}/aisdk.d.ts +6 -9
  16. package/dist/v2/effect/aisdk.js +1 -0
  17. package/dist/v2/effect/catalog.d.ts +29 -0
  18. package/dist/v2/effect/catalog.js +1 -0
  19. package/dist/v2/effect/command.d.ts +11 -0
  20. package/dist/v2/effect/command.js +1 -0
  21. package/dist/v2/effect/context.d.ts +21 -0
  22. package/dist/v2/effect/context.js +1 -0
  23. package/dist/v2/effect/event.d.ts +8 -0
  24. package/dist/v2/effect/event.js +1 -0
  25. package/dist/v2/effect/filesystem.d.ts +23 -0
  26. package/dist/v2/effect/filesystem.js +1 -0
  27. package/dist/v2/effect/index.d.ts +3 -0
  28. package/dist/v2/effect/index.js +1 -0
  29. package/dist/v2/effect/integration.d.ts +46 -0
  30. package/dist/v2/effect/integration.js +1 -0
  31. package/dist/v2/effect/location.d.ts +6 -0
  32. package/dist/v2/effect/location.js +1 -0
  33. package/dist/v2/effect/npm.d.ts +7 -0
  34. package/dist/v2/effect/npm.js +1 -0
  35. package/dist/v2/effect/path.d.ts +8 -0
  36. package/dist/v2/effect/path.js +1 -0
  37. package/dist/v2/effect/plugin.d.ts +11 -0
  38. package/dist/{promise → v2/effect}/reference.d.ts +5 -7
  39. package/dist/v2/effect/reference.js +1 -0
  40. package/dist/v2/effect/registration.d.ts +10 -0
  41. package/dist/v2/effect/registration.js +1 -0
  42. package/dist/v2/effect/skill.d.ts +9 -0
  43. package/dist/v2/effect/skill.js +1 -0
  44. package/dist/v2/options.js +1 -0
  45. package/dist/v2/promise/agent.d.ts +6 -0
  46. package/dist/v2/promise/agent.js +1 -0
  47. package/dist/{promise → v2/promise}/aisdk.d.ts +6 -9
  48. package/dist/v2/promise/aisdk.js +1 -0
  49. package/dist/v2/promise/catalog.d.ts +6 -0
  50. package/dist/v2/promise/catalog.js +1 -0
  51. package/dist/v2/promise/command.d.ts +6 -0
  52. package/dist/v2/promise/command.js +1 -0
  53. package/dist/v2/promise/context.d.ts +21 -0
  54. package/dist/v2/promise/context.js +1 -0
  55. package/dist/v2/promise/index.d.ts +12 -0
  56. package/dist/v2/promise/index.js +1 -0
  57. package/dist/v2/promise/integration.d.ts +12 -0
  58. package/dist/v2/promise/integration.js +1 -0
  59. package/dist/v2/promise/plugin.d.ts +10 -0
  60. package/dist/v2/promise/reference.d.ts +6 -0
  61. package/dist/v2/promise/reference.js +1 -0
  62. package/dist/v2/promise/registration.d.ts +9 -0
  63. package/dist/v2/promise/registration.js +1 -0
  64. package/dist/v2/promise/skill.d.ts +6 -0
  65. package/dist/v2/promise/skill.js +1 -0
  66. package/package.json +34 -33
  67. package/dist/app.d.ts +0 -5
  68. package/dist/app.js +0 -0
  69. package/dist/effect/agent.d.ts +0 -15
  70. package/dist/effect/agent.js +0 -0
  71. package/dist/effect/aisdk.js +0 -0
  72. package/dist/effect/catalog.d.ts +0 -33
  73. package/dist/effect/catalog.js +0 -2
  74. package/dist/effect/command.d.ts +0 -14
  75. package/dist/effect/command.js +0 -0
  76. package/dist/effect/event.d.ts +0 -3
  77. package/dist/effect/event.js +0 -0
  78. package/dist/effect/index.d.ts +0 -13
  79. package/dist/effect/index.js +0 -12
  80. package/dist/effect/integration.d.ts +0 -80
  81. package/dist/effect/integration.js +0 -2
  82. package/dist/effect/mcp.d.ts +0 -15
  83. package/dist/effect/mcp.js +0 -0
  84. package/dist/effect/plugin.d.ts +0 -43
  85. package/dist/effect/reference.d.ts +0 -13
  86. package/dist/effect/reference.js +0 -0
  87. package/dist/effect/registration.d.ts +0 -11
  88. package/dist/effect/registration.js +0 -0
  89. package/dist/effect/session.d.ts +0 -47
  90. package/dist/effect/session.js +0 -0
  91. package/dist/effect/shell.d.ts +0 -14
  92. package/dist/effect/shell.js +0 -0
  93. package/dist/effect/skill.d.ts +0 -14
  94. package/dist/effect/skill.js +0 -1
  95. package/dist/effect/storage.d.ts +0 -8
  96. package/dist/effect/storage.js +0 -0
  97. package/dist/effect/tool.d.ts +0 -40
  98. package/dist/effect/tool.js +0 -1
  99. package/dist/effect/websearch.d.ts +0 -20
  100. package/dist/effect/websearch.js +0 -0
  101. package/dist/options.js +0 -0
  102. package/dist/promise/adapter.d.ts +0 -12
  103. package/dist/promise/adapter.js +0 -257
  104. package/dist/promise/agent.d.ts +0 -15
  105. package/dist/promise/agent.js +0 -0
  106. package/dist/promise/aisdk.js +0 -0
  107. package/dist/promise/catalog.d.ts +0 -33
  108. package/dist/promise/catalog.js +0 -0
  109. package/dist/promise/command.d.ts +0 -13
  110. package/dist/promise/command.js +0 -0
  111. package/dist/promise/event.d.ts +0 -3
  112. package/dist/promise/event.js +0 -0
  113. package/dist/promise/index.d.ts +0 -14
  114. package/dist/promise/index.js +0 -12
  115. package/dist/promise/integration.d.ts +0 -79
  116. package/dist/promise/integration.js +0 -2
  117. package/dist/promise/mcp.d.ts +0 -15
  118. package/dist/promise/mcp.js +0 -0
  119. package/dist/promise/plugin.d.ts +0 -43
  120. package/dist/promise/reference.js +0 -0
  121. package/dist/promise/registration.d.ts +0 -10
  122. package/dist/promise/registration.js +0 -0
  123. package/dist/promise/session.d.ts +0 -47
  124. package/dist/promise/session.js +0 -0
  125. package/dist/promise/shell.d.ts +0 -14
  126. package/dist/promise/shell.js +0 -0
  127. package/dist/promise/skill.d.ts +0 -14
  128. package/dist/promise/skill.js +0 -0
  129. package/dist/promise/storage.d.ts +0 -8
  130. package/dist/promise/storage.js +0 -0
  131. package/dist/promise/tool.d.ts +0 -44
  132. package/dist/promise/tool.js +0 -2
  133. package/dist/promise/types.d.ts +0 -3
  134. package/dist/promise/types.js +0 -0
  135. package/dist/promise/websearch.d.ts +0 -21
  136. package/dist/promise/websearch.js +0 -0
  137. package/dist/storage.d.ts +0 -14
  138. package/dist/storage.js +0 -0
  139. package/dist/tui/context.d.ts +0 -421
  140. package/dist/tui/context.js +0 -0
  141. package/dist/tui/index.d.ts +0 -2
  142. package/dist/tui/index.js +0 -2
  143. package/dist/tui/plugin.d.ts +0 -8
  144. package/dist/tui/plugin.js +0 -3
  145. package/dist/tui/solid.d.ts +0 -7
  146. package/dist/tui/solid.js +0 -16
  147. /package/dist/{effect → v2/effect}/plugin.js +0 -0
  148. /package/dist/{options.d.ts → v2/options.d.ts} +0 -0
  149. /package/dist/{promise → v2/promise}/plugin.js +0 -0
@@ -1,12 +0,0 @@
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 { Mcp } from "@opencode-ai/schema/mcp";
8
- export { Model } from "@opencode-ai/schema/model";
9
- export { Provider } from "@opencode-ai/schema/provider";
10
- export { Reference } from "@opencode-ai/schema/reference";
11
- export { Skill } from "@opencode-ai/schema/skill";
12
- export { WebSearch } from "@opencode-ai/schema/websearch";
@@ -1,79 +0,0 @@
1
- import type { ConnectionInfo } from "@opencode-ai/client";
2
- import type { IntegrationApi } from "@opencode-ai/client/promise/api";
3
- import { Credential } from "@opencode-ai/schema/credential";
4
- import { Form } from "@opencode-ai/schema/form";
5
- import type { Transform } from "./registration.js";
6
- type IntegrationRef = {
7
- id: string;
8
- name: string;
9
- };
10
- export interface IntegrationOAuthMethod {
11
- readonly id: string;
12
- readonly type: "oauth";
13
- readonly label: string;
14
- readonly form?: Form.Fields;
15
- }
16
- export interface IntegrationCommandMethod {
17
- readonly id: string;
18
- readonly type: "command";
19
- readonly label: string;
20
- readonly command: ReadonlyArray<string>;
21
- }
22
- export interface IntegrationKeyMethod {
23
- readonly type: "key";
24
- readonly label?: string;
25
- readonly form?: Form.Fields;
26
- }
27
- export interface IntegrationEnvMethod {
28
- readonly type: "env";
29
- readonly names: ReadonlyArray<string>;
30
- }
31
- export type IntegrationMethod = IntegrationOAuthMethod | IntegrationCommandMethod | IntegrationKeyMethod | IntegrationEnvMethod;
32
- export type IntegrationOAuthAuthorization = {
33
- readonly url: string;
34
- readonly instructions: string;
35
- readonly expiresAt?: number;
36
- } & ({
37
- readonly mode: "auto";
38
- readonly callback: Promise<Credential.OAuth>;
39
- } | {
40
- readonly mode: "code";
41
- readonly callback: (code: string) => Promise<Credential.OAuth>;
42
- });
43
- export type IntegrationOAuthMethodRegistration = {
44
- readonly integrationID: string;
45
- readonly method: IntegrationOAuthMethod;
46
- readonly authorize: (answer: Form.Answer) => Promise<IntegrationOAuthAuthorization>;
47
- readonly refresh?: (credential: Credential.OAuth) => Promise<Credential.OAuth>;
48
- readonly label?: (credential: Credential.OAuth) => string | undefined;
49
- };
50
- export type IntegrationMethodRegistration = IntegrationOAuthMethodRegistration | {
51
- readonly integrationID: string;
52
- readonly method: IntegrationCommandMethod;
53
- } | {
54
- readonly integrationID: string;
55
- readonly method: IntegrationKeyMethod;
56
- } | {
57
- readonly integrationID: string;
58
- readonly method: IntegrationEnvMethod;
59
- };
60
- export interface IntegrationDraft {
61
- list(): readonly IntegrationRef[];
62
- get(id: string): IntegrationRef | undefined;
63
- update(id: string, update: (integration: IntegrationRef) => void): void;
64
- remove(id: string): void;
65
- readonly method: {
66
- list(integrationID: string): readonly IntegrationMethod[];
67
- update(input: IntegrationMethodRegistration): void;
68
- remove(integrationID: string, method: IntegrationMethod): void;
69
- };
70
- }
71
- export interface IntegrationDomain extends Omit<IntegrationApi, "wellknown"> {
72
- readonly transform: Transform<IntegrationDraft>;
73
- readonly reload: () => Promise<void>;
74
- readonly connection: {
75
- readonly active: (integrationID: string) => Promise<ConnectionInfo | undefined>;
76
- readonly resolve: (connection: ConnectionInfo) => Promise<Credential.Value | undefined>;
77
- };
78
- }
79
- export {};
@@ -1,2 +0,0 @@
1
- import { Credential } from "@opencode-ai/schema/credential";
2
- import { Form } from "@opencode-ai/schema/form";
@@ -1,15 +0,0 @@
1
- import type { McpApi } from "@opencode-ai/client/promise/api";
2
- import type { Mcp } from "@opencode-ai/schema/mcp";
3
- import type { Transform } from "./registration.js";
4
- import type { DeepMutable } from "./types.js";
5
- export interface MCPDraft {
6
- list(): readonly [string, DeepMutable<Mcp.ServerConfig>][];
7
- get(name: string): DeepMutable<Mcp.ServerConfig> | undefined;
8
- set(name: string, config: Mcp.ServerConfig): void;
9
- update(name: string, update: (config: DeepMutable<Mcp.ServerConfig>) => void): void;
10
- remove(name: string): void;
11
- }
12
- export interface MCPDomain extends Omit<McpApi, "resource"> {
13
- readonly transform: Transform<MCPDraft>;
14
- readonly reload: () => Promise<void>;
15
- }
File without changes
@@ -1,43 +0,0 @@
1
- import type { PluginApi } from "@opencode-ai/client/promise/api";
2
- import type { PluginOptions } from "../options.js";
3
- import type { App } from "../app.js";
4
- import type { AgentDomain } from "./agent.js";
5
- import type { AISDKDomain } from "./aisdk.js";
6
- import type { CatalogDomain } from "./catalog.js";
7
- import type { CommandDomain } from "./command.js";
8
- import type { EventDomain } from "./event.js";
9
- import type { IntegrationDomain } from "./integration.js";
10
- import type { MCPDomain } from "./mcp.js";
11
- import type { ReferenceDomain } from "./reference.js";
12
- import type { SessionDomain } from "./session.js";
13
- import type { ShellDomain } from "./shell.js";
14
- import type { SkillDomain } from "./skill.js";
15
- import type { StorageDomain } from "./storage.js";
16
- import type { ToolDomain } from "./tool.js";
17
- import type { WebSearchDomain } from "./websearch.js";
18
- export interface Context {
19
- readonly app: App;
20
- readonly options: PluginOptions;
21
- readonly agent: AgentDomain;
22
- readonly aisdk: AISDKDomain;
23
- readonly catalog: CatalogDomain;
24
- readonly command: CommandDomain;
25
- readonly event: EventDomain;
26
- readonly integration: IntegrationDomain;
27
- readonly mcp: MCPDomain;
28
- readonly plugin: PluginApi;
29
- readonly reference: ReferenceDomain;
30
- readonly session: SessionDomain;
31
- readonly shell: ShellDomain;
32
- readonly skill: SkillDomain;
33
- readonly storage: StorageDomain;
34
- readonly tool: ToolDomain;
35
- readonly websearch: WebSearchDomain;
36
- }
37
- export type Cleanup = () => Promise<void> | void;
38
- export interface Plugin {
39
- readonly id: string;
40
- readonly tui?: boolean;
41
- readonly setup: (context: Context) => Promise<Cleanup | void> | Cleanup | void;
42
- }
43
- export declare function define(plugin: Plugin): Plugin;
File without changes
@@ -1,10 +0,0 @@
1
- export interface Registration {
2
- readonly dispose: () => Promise<void>;
3
- }
4
- export interface ModelHookOptions {
5
- /** Limits the hook to one provider. Unscoped hooks apply to every provider. */
6
- readonly providerID?: string;
7
- }
8
- export type Hooks<Spec> = <Name extends keyof Spec>(name: Name, callback: (input: Spec[Name]) => Promise<void> | void) => Promise<Registration>;
9
- export type ModelHooks<Spec> = <Name extends keyof Spec>(name: Name, callback: (input: Spec[Name]) => Promise<void> | void, options?: ModelHookOptions) => Promise<Registration>;
10
- export type Transform<Input> = (callback: (input: Input) => void) => Promise<Registration>;
File without changes
@@ -1,47 +0,0 @@
1
- import type { SessionApi } from "@opencode-ai/client/promise/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, "create" | "get" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "synthetic" | "interrupt" | "rename" | "wait"> & {
46
- readonly hook: ModelHooks<SessionHooks>;
47
- };
File without changes
@@ -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
- }
File without changes
@@ -1,14 +0,0 @@
1
- import type { SkillApi } from "@opencode-ai/client/promise/api";
2
- import type { Skill } from "@opencode-ai/schema/skill";
3
- import type { Transform } from "./registration.js";
4
- import type { DeepMutable } from "./types.js";
5
- export interface SkillDraft {
6
- list(): readonly DeepMutable<Skill.Info>[];
7
- add(skill: Skill.Info): void;
8
- update(id: string, update: (skill: DeepMutable<Skill.Info>) => void): void;
9
- remove(id: string): void;
10
- }
11
- export interface SkillDomain extends SkillApi {
12
- readonly transform: Transform<SkillDraft>;
13
- readonly reload: () => Promise<void>;
14
- }
File without changes
@@ -1,8 +0,0 @@
1
- import type { Schema } from "effect";
2
- import type { StorageScanOptions, StorageScanResult } from "../storage.js";
3
- export interface StorageDomain {
4
- readonly get: (key: string) => Promise<Schema.Json | undefined>;
5
- readonly set: (key: string, value: Schema.Json) => Promise<void>;
6
- readonly remove: (key: string) => Promise<void>;
7
- readonly scan: (options: StorageScanOptions) => Promise<StorageScanResult>;
8
- }
File without changes
@@ -1,44 +0,0 @@
1
- export { CallID, Error } from "@opencode-ai/schema/tool";
2
- export type { Metadata, Options, Result } from "@opencode-ai/schema/tool";
3
- import { Tool } from "@opencode-ai/schema/tool";
4
- import type { Agent } from "@opencode-ai/schema/agent";
5
- import type { Session } from "@opencode-ai/schema/session";
6
- import type { SessionMessage } from "@opencode-ai/schema/session-message";
7
- import type { Hooks, Transform } from "./registration.js";
8
- export interface ToolContext extends Omit<Tool.Context, "progress"> {
9
- readonly progress: (update: Tool.Metadata) => Promise<void>;
10
- }
11
- export type Info<Input extends Tool.ValueSchema<any> = Tool.ValueSchema<any>, Output extends Tool.ValueSchema<any> | undefined = Tool.ValueSchema<any> | undefined> = Omit<Tool.Info<Input, Output>, "execute"> & {
12
- readonly execute: (input: Parameters<Tool.Info<Input, Output>["execute"]>[0], context: ToolContext) => Promise<Tool.Result<Output>>;
13
- };
14
- interface ToolDraft {
15
- add<Input extends Tool.ValueSchema<any>, Output extends Tool.ValueSchema<any> | undefined>(tool: Info<Input, Output>): void;
16
- }
17
- interface ToolHooks {
18
- readonly "execute.before": {
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
- input: unknown;
25
- };
26
- readonly "execute.after": {
27
- readonly tool: string;
28
- readonly sessionID: Session.ID;
29
- readonly agent: Agent.ID;
30
- readonly messageID: SessionMessage.ID;
31
- readonly id: Tool.CallID;
32
- readonly input: unknown;
33
- } & ({
34
- readonly status: "completed";
35
- result: Tool.Result;
36
- } | {
37
- readonly status: "error";
38
- error: Tool.Error;
39
- });
40
- }
41
- export interface ToolDomain {
42
- readonly transform: Transform<ToolDraft>;
43
- readonly hook: Hooks<ToolHooks>;
44
- }
@@ -1,2 +0,0 @@
1
- export { CallID, Error } from "@opencode-ai/schema/tool";
2
- import { Tool } from "@opencode-ai/schema/tool";
@@ -1,3 +0,0 @@
1
- export type DeepMutable<A> = A extends (...args: never[]) => unknown ? A : A extends ReadonlyMap<infer K, infer V> ? Map<DeepMutable<K>, DeepMutable<V>> : A extends ReadonlyArray<infer I> ? DeepMutable<I>[] : A extends object ? {
2
- -readonly [K in keyof A]: DeepMutable<A[K]>;
3
- } : A;
File without changes
@@ -1,21 +0,0 @@
1
- import type { WebSearch } from "@opencode-ai/schema/websearch";
2
- import type { WebSearchApi } from "@opencode-ai/client/promise/api";
3
- import type { Transform } from "./registration.js";
4
- export interface WebSearchDefinition {
5
- readonly id: string;
6
- readonly name: string;
7
- readonly execute: (input: WebSearch.ProviderInput, context: {
8
- readonly signal: AbortSignal;
9
- }) => Promise<readonly WebSearch.Result[]>;
10
- }
11
- export interface WebSearchDomain extends WebSearchApi {
12
- readonly transform: Transform<WebSearchDraft>;
13
- readonly reload: () => Promise<void>;
14
- }
15
- export interface WebSearchDraft {
16
- add(definition: WebSearchDefinition): void;
17
- readonly default: {
18
- get(): string | false | undefined;
19
- set(selection: string | false): void;
20
- };
21
- }
File without changes
package/dist/storage.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import type { Schema } from "effect";
2
- export interface StorageEntry {
3
- readonly key: string;
4
- readonly value: Schema.Json;
5
- }
6
- export interface StorageScanOptions {
7
- readonly prefix: string;
8
- readonly after?: string;
9
- readonly limit?: number;
10
- }
11
- export interface StorageScanResult {
12
- readonly entries: readonly StorageEntry[];
13
- readonly next?: string;
14
- }
package/dist/storage.js DELETED
File without changes