@opencode-ai/plugin 0.0.0-dev-17732 → 0.0.0-dev-202608201547

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 (151) 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.js +1 -0
  6. package/dist/shell.js +1 -0
  7. package/dist/{v1/tui.d.ts → tui.d.ts} +18 -70
  8. package/dist/v2/effect/agent.d.ts +12 -0
  9. package/dist/v2/effect/agent.js +1 -0
  10. package/dist/{effect → v2/effect}/aisdk.d.ts +6 -9
  11. package/dist/v2/effect/aisdk.js +1 -0
  12. package/dist/v2/effect/catalog.d.ts +29 -0
  13. package/dist/v2/effect/catalog.js +1 -0
  14. package/dist/v2/effect/command.d.ts +11 -0
  15. package/dist/v2/effect/command.js +1 -0
  16. package/dist/v2/effect/context.d.ts +21 -0
  17. package/dist/v2/effect/context.js +1 -0
  18. package/dist/v2/effect/event.d.ts +8 -0
  19. package/dist/v2/effect/event.js +1 -0
  20. package/dist/v2/effect/filesystem.d.ts +23 -0
  21. package/dist/v2/effect/filesystem.js +1 -0
  22. package/dist/v2/effect/index.d.ts +3 -0
  23. package/dist/v2/effect/index.js +1 -0
  24. package/dist/v2/effect/integration.d.ts +46 -0
  25. package/dist/v2/effect/integration.js +1 -0
  26. package/dist/v2/effect/location.d.ts +6 -0
  27. package/dist/v2/effect/location.js +1 -0
  28. package/dist/v2/effect/npm.d.ts +7 -0
  29. package/dist/v2/effect/npm.js +1 -0
  30. package/dist/v2/effect/path.d.ts +8 -0
  31. package/dist/v2/effect/path.js +1 -0
  32. package/dist/v2/effect/plugin.d.ts +11 -0
  33. package/dist/{promise → v2/effect}/reference.d.ts +5 -7
  34. package/dist/v2/effect/reference.js +1 -0
  35. package/dist/v2/effect/registration.d.ts +10 -0
  36. package/dist/v2/effect/registration.js +1 -0
  37. package/dist/v2/effect/skill.d.ts +9 -0
  38. package/dist/v2/effect/skill.js +1 -0
  39. package/dist/v2/options.js +1 -0
  40. package/dist/v2/promise/agent.d.ts +6 -0
  41. package/dist/v2/promise/agent.js +1 -0
  42. package/dist/{promise → v2/promise}/aisdk.d.ts +6 -9
  43. package/dist/v2/promise/aisdk.js +1 -0
  44. package/dist/v2/promise/catalog.d.ts +6 -0
  45. package/dist/v2/promise/catalog.js +1 -0
  46. package/dist/v2/promise/command.d.ts +6 -0
  47. package/dist/v2/promise/command.js +1 -0
  48. package/dist/v2/promise/context.d.ts +21 -0
  49. package/dist/v2/promise/context.js +1 -0
  50. package/dist/v2/promise/index.d.ts +12 -0
  51. package/dist/v2/promise/index.js +1 -0
  52. package/dist/v2/promise/integration.d.ts +12 -0
  53. package/dist/v2/promise/integration.js +1 -0
  54. package/dist/v2/promise/plugin.d.ts +10 -0
  55. package/dist/v2/promise/reference.d.ts +6 -0
  56. package/dist/v2/promise/reference.js +1 -0
  57. package/dist/v2/promise/registration.d.ts +9 -0
  58. package/dist/v2/promise/registration.js +1 -0
  59. package/dist/v2/promise/skill.d.ts +6 -0
  60. package/dist/v2/promise/skill.js +1 -0
  61. package/package.json +31 -40
  62. package/dist/app.d.ts +0 -5
  63. package/dist/app.js +0 -0
  64. package/dist/effect/agent.d.ts +0 -15
  65. package/dist/effect/agent.js +0 -0
  66. package/dist/effect/aisdk.js +0 -0
  67. package/dist/effect/catalog.d.ts +0 -33
  68. package/dist/effect/catalog.js +0 -2
  69. package/dist/effect/command.d.ts +0 -14
  70. package/dist/effect/command.js +0 -0
  71. package/dist/effect/event.d.ts +0 -3
  72. package/dist/effect/event.js +0 -0
  73. package/dist/effect/index.d.ts +0 -13
  74. package/dist/effect/index.js +0 -12
  75. package/dist/effect/integration.d.ts +0 -80
  76. package/dist/effect/integration.js +0 -2
  77. package/dist/effect/mcp.d.ts +0 -15
  78. package/dist/effect/mcp.js +0 -0
  79. package/dist/effect/plugin.d.ts +0 -43
  80. package/dist/effect/reference.d.ts +0 -13
  81. package/dist/effect/reference.js +0 -0
  82. package/dist/effect/registration.d.ts +0 -11
  83. package/dist/effect/registration.js +0 -0
  84. package/dist/effect/session.d.ts +0 -47
  85. package/dist/effect/session.js +0 -0
  86. package/dist/effect/shell.d.ts +0 -14
  87. package/dist/effect/shell.js +0 -0
  88. package/dist/effect/skill.d.ts +0 -14
  89. package/dist/effect/skill.js +0 -1
  90. package/dist/effect/storage.d.ts +0 -8
  91. package/dist/effect/storage.js +0 -0
  92. package/dist/effect/tool.d.ts +0 -40
  93. package/dist/effect/tool.js +0 -1
  94. package/dist/effect/websearch.d.ts +0 -20
  95. package/dist/effect/websearch.js +0 -0
  96. package/dist/options.js +0 -0
  97. package/dist/promise/adapter.d.ts +0 -12
  98. package/dist/promise/adapter.js +0 -255
  99. package/dist/promise/agent.d.ts +0 -15
  100. package/dist/promise/agent.js +0 -0
  101. package/dist/promise/aisdk.js +0 -0
  102. package/dist/promise/catalog.d.ts +0 -33
  103. package/dist/promise/catalog.js +0 -0
  104. package/dist/promise/command.d.ts +0 -13
  105. package/dist/promise/command.js +0 -0
  106. package/dist/promise/event.d.ts +0 -3
  107. package/dist/promise/event.js +0 -0
  108. package/dist/promise/index.d.ts +0 -14
  109. package/dist/promise/index.js +0 -12
  110. package/dist/promise/integration.d.ts +0 -79
  111. package/dist/promise/integration.js +0 -2
  112. package/dist/promise/mcp.d.ts +0 -15
  113. package/dist/promise/mcp.js +0 -0
  114. package/dist/promise/plugin.d.ts +0 -43
  115. package/dist/promise/reference.js +0 -0
  116. package/dist/promise/registration.d.ts +0 -10
  117. package/dist/promise/registration.js +0 -0
  118. package/dist/promise/session.d.ts +0 -47
  119. package/dist/promise/session.js +0 -0
  120. package/dist/promise/shell.d.ts +0 -14
  121. package/dist/promise/shell.js +0 -0
  122. package/dist/promise/skill.d.ts +0 -14
  123. package/dist/promise/skill.js +0 -0
  124. package/dist/promise/storage.d.ts +0 -8
  125. package/dist/promise/storage.js +0 -0
  126. package/dist/promise/tool.d.ts +0 -44
  127. package/dist/promise/tool.js +0 -2
  128. package/dist/promise/types.d.ts +0 -3
  129. package/dist/promise/types.js +0 -0
  130. package/dist/promise/websearch.d.ts +0 -21
  131. package/dist/promise/websearch.js +0 -0
  132. package/dist/storage.d.ts +0 -14
  133. package/dist/storage.js +0 -0
  134. package/dist/tui/context.d.ts +0 -421
  135. package/dist/tui/context.js +0 -0
  136. package/dist/tui/index.d.ts +0 -2
  137. package/dist/tui/index.js +0 -2
  138. package/dist/tui/plugin.d.ts +0 -8
  139. package/dist/tui/plugin.js +0 -3
  140. package/dist/tui/solid.d.ts +0 -7
  141. package/dist/tui/solid.js +0 -16
  142. package/dist/v1/index.js +0 -2
  143. package/dist/v1/shell.js +0 -0
  144. /package/dist/{v1/index.d.ts → index.d.ts} +0 -0
  145. /package/dist/{v1/shell.d.ts → shell.d.ts} +0 -0
  146. /package/dist/{v1/tool.d.ts → tool.d.ts} +0 -0
  147. /package/dist/{v1/tool.js → tool.js} +0 -0
  148. /package/dist/{v1/tui.js → tui.js} +0 -0
  149. /package/dist/{effect → v2/effect}/plugin.js +0 -0
  150. /package/dist/{options.d.ts → v2/options.d.ts} +0 -0
  151. /package/dist/{promise → v2/promise}/plugin.js +0 -0
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from "@opencode-ai/plugin";
2
+ export declare const FolderWorkspacePlugin: Plugin;
3
+ export default FolderWorkspacePlugin;
@@ -0,0 +1,30 @@
1
+ import { mkdir, rm } from "node:fs/promises";
2
+ export const FolderWorkspacePlugin = async ({ experimental_workspace }) => {
3
+ experimental_workspace.register("folder", {
4
+ name: "Folder",
5
+ description: "Create a blank folder",
6
+ configure(config) {
7
+ const rand = "" + Math.random();
8
+ return {
9
+ ...config,
10
+ directory: `/tmp/folder/folder-${rand}`,
11
+ };
12
+ },
13
+ async create(config) {
14
+ if (!config.directory)
15
+ return;
16
+ await mkdir(config.directory, { recursive: true });
17
+ },
18
+ async remove(config) {
19
+ await rm(config.directory, { recursive: true, force: true });
20
+ },
21
+ target(config) {
22
+ return {
23
+ type: "local",
24
+ directory: config.directory,
25
+ };
26
+ },
27
+ });
28
+ return {};
29
+ };
30
+ export default FolderWorkspacePlugin;
@@ -0,0 +1,2 @@
1
+ import { Plugin } from "./index.js";
2
+ export declare const ExamplePlugin: Plugin;
@@ -0,0 +1,16 @@
1
+ import { tool } from "./tool.js";
2
+ export const ExamplePlugin = async (_ctx) => {
3
+ return {
4
+ tool: {
5
+ mytool: tool({
6
+ description: "This is a custom tool",
7
+ args: {
8
+ foo: tool.schema.string().describe("foo"),
9
+ },
10
+ async execute(args) {
11
+ return `Hello ${args.foo}!`;
12
+ },
13
+ }),
14
+ },
15
+ };
16
+ };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./tool.js";
package/dist/shell.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,4 @@
1
- import type { OpencodeClient, LspStatus, McpStatus, Message, Part, Provider, PermissionRequest, QuestionRequest, Session, SessionStatus, Config as SdkConfig } from "@opencode-ai/sdk/v2";
2
- import type { OpenCodeEvent } from "@opencode-ai/client/promise";
3
- import type { PromptInput } from "@opencode-ai/schema";
4
- import type { Types } from "effect";
1
+ import type { AgentPart, OpencodeClient, Event, FilePart, LspStatus, McpStatus, Todo, Message, Part, Provider, PermissionRequest, QuestionRequest, Session, SessionStatus, TextPart, Config as SdkConfig } from "@opencode-ai/sdk/v2";
5
2
  import type { CliRenderer, KeyEvent, RGBA, Renderable, SlotMode } from "@opentui/core";
6
3
  import type { Binding, Keymap } from "@opentui/keymap";
7
4
  import { type BindingConfig, type CreateBindingLookupOptions, type KeySequenceFormatPart, type SequenceBindingLike } from "@opentui/keymap/extras";
@@ -128,16 +125,18 @@ export type TuiDialogSelectProps<Value = unknown> = {
128
125
  skipFilter?: boolean;
129
126
  current?: Value;
130
127
  };
131
- export type TuiPromptInfo = Types.DeepMutable<PromptInput.Prompt> & {
132
- pasted: {
133
- text: string;
134
- source: {
135
- start: number;
136
- end: number;
137
- text: string;
138
- };
139
- }[];
128
+ export type TuiPromptInfo = {
129
+ input: string;
140
130
  mode?: "normal" | "shell";
131
+ parts: (Omit<FilePart, "id" | "messageID" | "sessionID"> | Omit<AgentPart, "id" | "messageID" | "sessionID"> | (Omit<TextPart, "id" | "messageID" | "sessionID"> & {
132
+ source?: {
133
+ text: {
134
+ start: number;
135
+ end: number;
136
+ value: string;
137
+ };
138
+ };
139
+ }))[];
141
140
  };
142
141
  export type TuiPromptRef = {
143
142
  focused: boolean;
@@ -280,7 +279,6 @@ export type TuiTheme = {
280
279
  mode: () => "dark" | "light";
281
280
  readonly ready: boolean;
282
281
  };
283
- /** @deprecated Persistent TUI KV storage is not supported in V2. */
284
282
  export type TuiKV = {
285
283
  get: <Value = unknown>(key: string, fallback?: Value) => Value;
286
284
  set: (key: string, value: unknown) => void;
@@ -304,6 +302,7 @@ export type TuiState = {
304
302
  count: () => number;
305
303
  get: (sessionID: string) => Session | undefined;
306
304
  diff: (sessionID: string) => ReadonlyArray<TuiSidebarFileItem>;
305
+ todo: (sessionID: string) => ReadonlyArray<TuiSidebarTodoItem>;
307
306
  messages: (sessionID: string) => ReadonlyArray<Message>;
308
307
  status: (sessionID: string) => SessionStatus | undefined;
309
308
  permission: (sessionID: string) => ReadonlyArray<PermissionRequest>;
@@ -329,60 +328,10 @@ type TuiAttentionConfigView = {
329
328
  sound_pack: string;
330
329
  sounds: Partial<Record<TuiAttentionSoundName, string>>;
331
330
  };
332
- type TuiConfigView = {
333
- $schema?: string;
334
- theme?: string | {
335
- name?: string;
336
- mode?: "system" | "dark" | "light";
337
- };
338
- plugin?: PluginConfig["plugin"];
339
- plugins?: ReadonlyArray<string | {
340
- package: string;
341
- options?: Record<string, any>;
342
- }>;
343
- plugin_enabled?: Record<string, boolean>;
344
- leader?: {
345
- timeout: number;
346
- };
347
- leader_timeout?: number;
348
- scroll?: {
349
- speed?: number;
350
- acceleration?: boolean;
351
- };
352
- scroll_speed?: number;
353
- scroll_acceleration?: {
354
- enabled: boolean;
355
- };
331
+ type TuiConfigView = Pick<PluginConfig, "$schema" | "theme" | "plugin"> & NonNullable<PluginConfig["tui"]> & {
332
+ leader_timeout: number;
356
333
  attention: TuiAttentionConfigView;
357
- diffs?: {
358
- wrap?: "word" | "none";
359
- tree?: boolean;
360
- single?: boolean;
361
- view?: "auto" | "split" | "unified";
362
- };
363
- diff_style?: "auto" | "stacked";
364
- terminal?: {
365
- title?: boolean;
366
- };
367
- prompt?: {
368
- editor?: boolean;
369
- paste?: "compact" | "full";
370
- } | {
371
- max_height?: number;
372
- max_width?: number | "auto";
373
- };
374
- session?: {
375
- sidebar?: "auto" | "hide";
376
- scrollbar?: boolean;
377
- thinking?: "show" | "hide";
378
- markdown?: "source" | "rendered";
379
- grouping?: "auto" | "none";
380
- };
381
- hints?: {
382
- onboarding?: boolean;
383
- };
384
- animations?: boolean;
385
- mouse: boolean;
334
+ plugin_enabled?: Record<string, boolean>;
386
335
  keybinds: TuiBindingLookupView;
387
336
  };
388
337
  export type TuiApp = {
@@ -397,6 +346,7 @@ export type TuiSidebarMcpItem = {
397
346
  error?: string;
398
347
  };
399
348
  export type TuiSidebarLspItem = Pick<LspStatus, "id" | "root" | "status">;
349
+ export type TuiSidebarTodoItem = Pick<Todo, "content" | "status">;
400
350
  export type TuiSidebarFileItem = {
401
351
  file: string;
402
352
  additions: number;
@@ -432,7 +382,6 @@ export type TuiHostSlotMap = {
432
382
  };
433
383
  sidebar_footer: {
434
384
  session_id: string;
435
- directory: string;
436
385
  };
437
386
  };
438
387
  export type TuiSlotMap<Slots extends Record<string, object> = {}> = TuiHostSlotMap & Slots;
@@ -456,7 +405,7 @@ export type TuiSlots = {
456
405
  };
457
406
  };
458
407
  export type TuiEventBus = {
459
- on: <Type extends OpenCodeEvent["type"]>(type: Type, handler: (event: Extract<OpenCodeEvent, {
408
+ on: <Type extends Event["type"]>(type: Type, handler: (event: Extract<Event, {
460
409
  type: Type;
461
410
  }>) => void) => () => void;
462
411
  };
@@ -537,7 +486,6 @@ export type TuiPluginApi = {
537
486
  dialog: TuiDialogStack;
538
487
  };
539
488
  readonly tuiConfig: Frozen<TuiConfigView>;
540
- /** @deprecated Persistent TUI KV storage is not supported in V2. */
541
489
  kv: TuiKV;
542
490
  state: TuiState;
543
491
  theme: TuiTheme;
@@ -0,0 +1,12 @@
1
+ import type { AgentV2Info } from "@opencode-ai/sdk/v2/types";
2
+ import type { Hooks } from "./registration.js";
3
+ export interface AgentDraft {
4
+ list(): readonly AgentV2Info[];
5
+ get(id: string): AgentV2Info | undefined;
6
+ default(id: string | undefined): void;
7
+ update(id: string, update: (agent: AgentV2Info) => void): void;
8
+ remove(id: string): void;
9
+ }
10
+ export type AgentHooks = Hooks<{
11
+ transform: AgentDraft;
12
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,20 +1,17 @@
1
1
  import type { LanguageModelV3 } from "@ai-sdk/provider";
2
- import type { Model } from "@opencode-ai/schema/model";
3
- import type { ModelHooks } from "./registration.js";
4
- export interface AISDKHooks {
2
+ import type { ModelV2Info } from "@opencode-ai/sdk/v2/types";
3
+ import type { Hooks } from "./registration.js";
4
+ export type AISDKHooks = Hooks<{
5
5
  sdk: {
6
- readonly model: Model.Info;
6
+ readonly model: ModelV2Info;
7
7
  readonly package: string;
8
8
  readonly options: Record<string, any>;
9
9
  sdk?: any;
10
10
  };
11
11
  language: {
12
- readonly model: Model.Info;
12
+ readonly model: ModelV2Info;
13
13
  readonly sdk: any;
14
14
  readonly options: Record<string, any>;
15
15
  language?: LanguageModelV3;
16
16
  };
17
- }
18
- export interface AISDKDomain {
19
- readonly hook: ModelHooks<AISDKHooks>;
20
- }
17
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { ModelV2Info, ProviderV2Info } from "@opencode-ai/sdk/v2/types";
2
+ import type { Hooks } from "./registration.js";
3
+ export interface CatalogProviderRecord {
4
+ readonly provider: ProviderV2Info;
5
+ readonly models: ReadonlyMap<string, ModelV2Info>;
6
+ }
7
+ export interface CatalogDraft {
8
+ readonly provider: {
9
+ list(): readonly CatalogProviderRecord[];
10
+ get(providerID: string): CatalogProviderRecord | undefined;
11
+ update(providerID: string, update: (provider: ProviderV2Info) => void): void;
12
+ remove(providerID: string): void;
13
+ };
14
+ readonly model: {
15
+ get(providerID: string, modelID: string): ModelV2Info | undefined;
16
+ update(providerID: string, modelID: string, update: (model: ModelV2Info) => void): void;
17
+ remove(providerID: string, modelID: string): void;
18
+ readonly default: {
19
+ get(): {
20
+ providerID: string;
21
+ modelID: string;
22
+ } | undefined;
23
+ set(providerID: string, modelID: string): void;
24
+ };
25
+ };
26
+ }
27
+ export type CatalogHooks = Hooks<{
28
+ transform: CatalogDraft;
29
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { CommandV2Info } from "@opencode-ai/sdk/v2/types";
2
+ import type { Hooks } from "./registration.js";
3
+ export interface CommandDraft {
4
+ list(): readonly CommandV2Info[];
5
+ get(name: string): CommandV2Info | undefined;
6
+ update(name: string, update: (command: CommandV2Info) => void): void;
7
+ remove(name: string): void;
8
+ }
9
+ export type CommandHooks = Hooks<{
10
+ transform: CommandDraft;
11
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { PluginOptions } from "../options.js";
2
+ import type { AgentHooks } from "./agent.js";
3
+ import type { AISDKHooks } from "./aisdk.js";
4
+ import type { CatalogHooks } from "./catalog.js";
5
+ import type { CommandHooks } from "./command.js";
6
+ import type { IntegrationHooks } from "./integration.js";
7
+ import type { PluginDomain } from "./plugin.js";
8
+ import type { ReferenceHooks } from "./reference.js";
9
+ import type { SkillHooks } from "./skill.js";
10
+ import type { Reload } from "./registration.js";
11
+ export interface PluginContext {
12
+ readonly options: PluginOptions;
13
+ readonly agent: AgentHooks & Reload;
14
+ readonly aisdk: AISDKHooks;
15
+ readonly catalog: CatalogHooks & Reload;
16
+ readonly command: CommandHooks & Reload;
17
+ readonly integration: IntegrationHooks & Reload;
18
+ readonly plugin: PluginDomain;
19
+ readonly reference: ReferenceHooks & Reload;
20
+ readonly skill: SkillHooks & Reload;
21
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { Event as SDKEvent } from "@opencode-ai/sdk/v2/types";
2
+ import type { Stream } from "effect";
3
+ export type EventMap = {
4
+ [Item in SDKEvent as Item["type"]]: Item;
5
+ };
6
+ export interface Event {
7
+ subscribe<Type extends keyof EventMap>(type: Type): Stream.Stream<EventMap[Type]>;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { FileSystemEntry } from "@opencode-ai/sdk/v2/types";
2
+ import type { Effect } from "effect";
3
+ export interface FileSystem {
4
+ read(input: {
5
+ readonly path: string;
6
+ }): Effect.Effect<{
7
+ readonly content: Uint8Array;
8
+ readonly mime: string;
9
+ }>;
10
+ list(input?: {
11
+ readonly path?: string;
12
+ }): Effect.Effect<FileSystemEntry[]>;
13
+ find(input: {
14
+ readonly query: string;
15
+ readonly type?: "file" | "directory";
16
+ readonly limit?: number;
17
+ }): Effect.Effect<FileSystemEntry[]>;
18
+ glob(input: {
19
+ readonly pattern: string;
20
+ readonly path?: string;
21
+ readonly limit?: number;
22
+ }): Effect.Effect<readonly FileSystemEntry[]>;
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export type { PluginContext } from "./context.js";
2
+ export { define } from "./plugin.js";
3
+ export type { Plugin } from "./plugin.js";
@@ -0,0 +1 @@
1
+ export { define } from "./plugin.js";
@@ -0,0 +1,46 @@
1
+ import type { ConnectionInfo, CredentialOAuth, CredentialValue, IntegrationEnvMethod, IntegrationInputs, IntegrationKeyMethod, IntegrationMethod, IntegrationOAuthMethod, IntegrationRef } from "@opencode-ai/sdk/v2/types";
2
+ import type { Effect, Scope } from "effect";
3
+ import type { Hooks } from "./registration.js";
4
+ export type IntegrationOAuthAuthorization = {
5
+ readonly url: string;
6
+ readonly instructions: string;
7
+ } & ({
8
+ readonly mode: "auto";
9
+ readonly callback: Effect.Effect<CredentialOAuth, unknown>;
10
+ } | {
11
+ readonly mode: "code";
12
+ readonly callback: (code: string) => Effect.Effect<CredentialOAuth, unknown>;
13
+ });
14
+ export type IntegrationOAuthMethodRegistration = {
15
+ readonly integrationID: string;
16
+ readonly method: IntegrationOAuthMethod;
17
+ readonly authorize: (inputs: IntegrationInputs) => Effect.Effect<IntegrationOAuthAuthorization, unknown, Scope.Scope>;
18
+ readonly refresh?: (credential: CredentialOAuth) => Effect.Effect<CredentialOAuth, unknown>;
19
+ readonly label?: (credential: CredentialOAuth) => string | undefined;
20
+ };
21
+ export type IntegrationMethodRegistration = IntegrationOAuthMethodRegistration | {
22
+ readonly integrationID: string;
23
+ readonly method: IntegrationKeyMethod;
24
+ } | {
25
+ readonly integrationID: string;
26
+ readonly method: IntegrationEnvMethod;
27
+ };
28
+ export interface IntegrationDraft {
29
+ list(): readonly IntegrationRef[];
30
+ get(id: string): IntegrationRef | undefined;
31
+ update(id: string, update: (integration: IntegrationRef) => void): void;
32
+ remove(id: string): void;
33
+ readonly method: {
34
+ list(integrationID: string): readonly IntegrationMethod[];
35
+ update(input: IntegrationMethodRegistration): void;
36
+ remove(integrationID: string, method: IntegrationMethod): void;
37
+ };
38
+ }
39
+ export interface IntegrationHooks extends Hooks<{
40
+ transform: IntegrationDraft;
41
+ }> {
42
+ readonly connection: {
43
+ readonly active: (integrationID: string) => Effect.Effect<ConnectionInfo | undefined>;
44
+ readonly resolve: (connection: ConnectionInfo) => Effect.Effect<CredentialValue | undefined, unknown>;
45
+ };
46
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export interface Location {
2
+ readonly directory: string;
3
+ readonly project: {
4
+ readonly directory: string;
5
+ };
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { Effect } from "effect";
2
+ export interface Npm {
3
+ add(pkg: string): Effect.Effect<{
4
+ readonly directory: string;
5
+ readonly entrypoint?: string;
6
+ }, unknown>;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export interface Path {
2
+ readonly home: string;
3
+ readonly data: string;
4
+ readonly cache: string;
5
+ readonly config: string;
6
+ readonly state: string;
7
+ readonly temp: string;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { Effect, Scope } from "effect";
2
+ import type { PluginContext } from "./context.js";
3
+ export interface Plugin<R = Scope.Scope> {
4
+ readonly id: string;
5
+ readonly effect: (context: PluginContext) => Effect.Effect<void, never, R>;
6
+ }
7
+ export declare function define<R = Scope.Scope>(plugin: Plugin<R>): Plugin<R>;
8
+ export interface PluginDomain {
9
+ readonly add: (plugin: Plugin) => Effect.Effect<void>;
10
+ readonly remove: (id: string) => Effect.Effect<void>;
11
+ }
@@ -1,12 +1,10 @@
1
- import type { ReferenceApi } from "@opencode-ai/client/promise/api";
2
- import type { ReferenceGitSource, ReferenceLocalSource } from "@opencode-ai/client";
3
- import type { Transform } from "./registration.js";
1
+ import type { ReferenceGitSource, ReferenceLocalSource } from "@opencode-ai/sdk/v2/types";
2
+ import type { Hooks } from "./registration.js";
4
3
  export interface ReferenceDraft {
5
4
  add(name: string, source: ReferenceLocalSource | ReferenceGitSource): void;
6
5
  remove(name: string): void;
7
6
  list(): readonly (readonly [string, ReferenceLocalSource | ReferenceGitSource])[];
8
7
  }
9
- export interface ReferenceDomain extends ReferenceApi {
10
- readonly transform: Transform<ReferenceDraft>;
11
- readonly reload: () => Promise<void>;
12
- }
8
+ export type ReferenceHooks = Hooks<{
9
+ transform: ReferenceDraft;
10
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { Effect, Scope } from "effect";
2
+ export interface Registration {
3
+ readonly dispose: Effect.Effect<void>;
4
+ }
5
+ export interface Reload {
6
+ readonly reload: () => Effect.Effect<void>;
7
+ }
8
+ export type Hooks<Spec> = {
9
+ readonly [Name in keyof Spec]: (callback: (input: Spec[Name]) => Effect.Effect<void> | void) => Effect.Effect<Registration, never, Scope.Scope>;
10
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { SkillV2Source } from "@opencode-ai/sdk/v2/types";
2
+ import type { Hooks } from "./registration.js";
3
+ export interface SkillDraft {
4
+ source(source: SkillV2Source): void;
5
+ list(): readonly SkillV2Source[];
6
+ }
7
+ export type SkillHooks = Hooks<{
8
+ transform: SkillDraft;
9
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { AgentDraft } from "../effect/agent.js";
2
+ import type { Hooks } from "./registration.js";
3
+ export type { AgentDraft };
4
+ export type AgentHooks = Hooks<{
5
+ transform: AgentDraft;
6
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,20 +1,17 @@
1
1
  import type { LanguageModelV3 } from "@ai-sdk/provider";
2
- import type { Model } from "@opencode-ai/schema/model";
3
- import type { ModelHooks } from "./registration.js";
4
- export interface AISDKHooks {
2
+ import type { ModelV2Info } from "@opencode-ai/sdk/v2/types";
3
+ import type { Hooks } from "./registration.js";
4
+ export type AISDKHooks = Hooks<{
5
5
  sdk: {
6
- readonly model: Model.Info;
6
+ readonly model: ModelV2Info;
7
7
  readonly package: string;
8
8
  readonly options: Record<string, any>;
9
9
  sdk?: any;
10
10
  };
11
11
  language: {
12
- readonly model: Model.Info;
12
+ readonly model: ModelV2Info;
13
13
  readonly sdk: any;
14
14
  readonly options: Record<string, any>;
15
15
  language?: LanguageModelV3;
16
16
  };
17
- }
18
- export interface AISDKDomain {
19
- readonly hook: ModelHooks<AISDKHooks>;
20
- }
17
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { CatalogDraft, CatalogProviderRecord } from "../effect/catalog.js";
2
+ import type { Hooks } from "./registration.js";
3
+ export type { CatalogDraft, CatalogProviderRecord };
4
+ export type CatalogHooks = Hooks<{
5
+ transform: CatalogDraft;
6
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { CommandDraft } from "../effect/command.js";
2
+ import type { Hooks } from "./registration.js";
3
+ export type { CommandDraft };
4
+ export type CommandHooks = Hooks<{
5
+ transform: CommandDraft;
6
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { PluginOptions } from "../options.js";
2
+ import type { AgentHooks } from "./agent.js";
3
+ import type { AISDKHooks } from "./aisdk.js";
4
+ import type { CatalogHooks } from "./catalog.js";
5
+ import type { CommandHooks } from "./command.js";
6
+ import type { IntegrationHooks } from "./integration.js";
7
+ import type { PluginDomain } from "./plugin.js";
8
+ import type { ReferenceHooks } from "./reference.js";
9
+ import type { SkillHooks } from "./skill.js";
10
+ import type { Reload } from "./registration.js";
11
+ export interface PluginContext {
12
+ readonly options: PluginOptions;
13
+ readonly agent: AgentHooks & Reload;
14
+ readonly aisdk: AISDKHooks;
15
+ readonly catalog: CatalogHooks & Reload;
16
+ readonly command: CommandHooks & Reload;
17
+ readonly integration: IntegrationHooks & Reload;
18
+ readonly plugin: PluginDomain;
19
+ readonly reference: ReferenceHooks & Reload;
20
+ readonly skill: SkillHooks & Reload;
21
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export type { PluginContext } from "./context.js";
2
+ export type { PluginOptions } from "../options.js";
3
+ export { define } from "./plugin.js";
4
+ export type { Plugin, PluginDomain } from "./plugin.js";
5
+ export type { Registration, Reload } from "./registration.js";
6
+ export type { AgentDraft, AgentHooks } from "./agent.js";
7
+ export type { AISDKHooks } from "./aisdk.js";
8
+ export type { CatalogDraft, CatalogHooks, CatalogProviderRecord } from "./catalog.js";
9
+ export type { CommandDraft, CommandHooks } from "./command.js";
10
+ export type { IntegrationDraft, IntegrationHooks, IntegrationMethodRegistration } from "./integration.js";
11
+ export type { ReferenceDraft, ReferenceHooks } from "./reference.js";
12
+ export type { SkillDraft, SkillHooks } from "./skill.js";
@@ -0,0 +1 @@
1
+ export { define } from "./plugin.js";