@opencode-ai/plugin 0.0.0-next-16381 → 0.0.0-next-16384

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.
@@ -1,5 +1,5 @@
1
1
  import type { AgentInfo, CommandInfo, FormInfo, IntegrationInfo, LocationRef, McpResource, McpServer, ModelInfo, OpenCodeClient, OpenCodeEvent, PermissionSavedInfo, PermissionRequest, ProviderInfo, ReferenceInfo, SessionInfo, SessionMessageInfo, SessionPendingInfo, ShellInfo, SkillInfo } from "@opencode-ai/client";
2
- import type { KeyEvent, Renderable } from "@opentui/core";
2
+ import type { CliRenderer, KeyEvent, Renderable } from "@opentui/core";
3
3
  import type { JSX } from "@opentui/solid";
4
4
  interface LocationCollection<Value> {
5
5
  list(location?: LocationRef): Value[] | undefined;
@@ -97,6 +97,90 @@ export interface Page {
97
97
  }) => JSX.Element;
98
98
  }
99
99
  export type Slot = (props: Record<string, any>) => JSX.Element;
100
+ export type ToastVariant = "info" | "success" | "warning" | "error";
101
+ export interface ToastOptions {
102
+ readonly title?: string;
103
+ readonly message: string;
104
+ readonly variant?: ToastVariant;
105
+ readonly duration?: number;
106
+ }
107
+ export interface Toast {
108
+ show(options: ToastOptions): void;
109
+ }
110
+ export type AttentionWhen = "always" | "focused" | "blurred";
111
+ export type AttentionSoundName = "default" | "question" | "permission" | "error" | "done" | "subagent_done";
112
+ export type AttentionNotification = boolean | {
113
+ readonly when?: AttentionWhen;
114
+ };
115
+ export type AttentionSound = boolean | {
116
+ readonly name?: AttentionSoundName;
117
+ readonly volume?: number;
118
+ readonly when?: AttentionWhen;
119
+ };
120
+ export interface AttentionNotifyOptions {
121
+ readonly title?: string;
122
+ readonly message: string;
123
+ readonly notification?: AttentionNotification;
124
+ readonly sound?: AttentionSound;
125
+ }
126
+ export type AttentionNotifySkipReason = "attention_disabled" | "empty_message" | "blurred" | "focused" | "focus_unknown" | "renderer_destroyed";
127
+ export interface AttentionNotifyResult {
128
+ readonly ok: boolean;
129
+ readonly notification: boolean;
130
+ readonly sound: boolean;
131
+ readonly skipped?: AttentionNotifySkipReason;
132
+ }
133
+ export interface Attention {
134
+ notify(options: AttentionNotifyOptions): Promise<AttentionNotifyResult>;
135
+ }
136
+ export type DialogSize = "medium" | "large" | "xlarge";
137
+ export interface DialogOptions {
138
+ readonly size?: DialogSize;
139
+ readonly centered?: boolean;
140
+ }
141
+ export interface DialogAlertOptions {
142
+ readonly title: string;
143
+ readonly message: string;
144
+ }
145
+ export interface DialogConfirmOptions {
146
+ readonly title: string;
147
+ readonly message: string;
148
+ readonly label?: {
149
+ readonly confirm?: string;
150
+ readonly cancel?: string;
151
+ };
152
+ }
153
+ export interface DialogPromptOptions {
154
+ readonly title: string;
155
+ readonly description?: string;
156
+ readonly placeholder?: string;
157
+ readonly value?: string;
158
+ }
159
+ export interface DialogSelectOption<Value> {
160
+ readonly title: string;
161
+ readonly value: Value;
162
+ readonly description?: string;
163
+ readonly category?: string;
164
+ readonly disabled?: boolean;
165
+ }
166
+ export interface DialogSelectOptions<Value> {
167
+ readonly title: string;
168
+ readonly placeholder?: string;
169
+ readonly options: readonly DialogSelectOption<Value>[];
170
+ readonly current?: Value;
171
+ }
172
+ export interface Dialog {
173
+ /** Shows a dialog and returns a function that closes it. */
174
+ show(render: () => JSX.Element, onClose?: () => void): () => void;
175
+ /** Sets the presentation options for this plugin's active dialog. */
176
+ set(options: DialogOptions): void;
177
+ /** Closes this plugin's active dialog. */
178
+ clear(): void;
179
+ alert(options: DialogAlertOptions): Promise<void>;
180
+ confirm(options: DialogConfirmOptions): Promise<boolean | undefined>;
181
+ prompt(options: DialogPromptOptions): Promise<string | undefined>;
182
+ select<Value>(options: DialogSelectOptions<Value>): Promise<Value | undefined>;
183
+ }
100
184
  export interface KeymapCommand {
101
185
  /** Stable command and config keybind identifier. Omit for an inline command. */
102
186
  readonly id?: string;
@@ -138,13 +222,30 @@ export interface KeymapLayer {
138
222
  /** IDs of commands whose configured bindings should be active in this layer. */
139
223
  readonly bindings?: readonly string[];
140
224
  }
225
+ export interface KeymapPending {
226
+ readonly key: string;
227
+ readonly token?: string;
228
+ }
229
+ export interface KeymapActive {
230
+ readonly key: string;
231
+ readonly title?: string;
232
+ readonly description?: string;
233
+ readonly group?: string;
234
+ readonly continues: boolean;
235
+ }
141
236
  export interface Keymap {
142
237
  /** Creates a reactive keymap layer owned by the calling component. */
143
238
  layer(input: () => KeymapLayer): void;
144
239
  /** Dispatches a reachable command by ID. */
145
240
  dispatch(id: string, input?: string): void;
146
- /** Returns the formatted shortcut for a registered command. */
147
- shortcut(id: string): string | undefined;
241
+ /** Returns every formatted shortcut for a registered command. */
242
+ shortcuts(id: string): readonly string[];
243
+ /** Returns the currently reachable commands. Reactive when read in a Solid computation. */
244
+ commands(): readonly KeymapCommand[];
245
+ /** Returns the pending key sequence. Reactive when read in a Solid computation. */
246
+ pending(): readonly KeymapPending[];
247
+ /** Returns bindings reachable from the pending key sequence. Reactive when read in a Solid computation. */
248
+ active(): readonly KeymapActive[];
148
249
  /** Controls mutually exclusive OpenCode input modes. */
149
250
  readonly mode: {
150
251
  /** Returns the active mode. */
@@ -154,6 +255,8 @@ export interface Keymap {
154
255
  };
155
256
  }
156
257
  export interface UI {
258
+ readonly dialog: Dialog;
259
+ readonly toast: Toast;
157
260
  readonly router: {
158
261
  register(page: Page): () => void;
159
262
  navigate(destination: Destination): void;
@@ -164,8 +267,11 @@ export interface UI {
164
267
  export interface Context {
165
268
  readonly options: Readonly<Record<string, any>>;
166
269
  readonly location: LocationRef | undefined;
270
+ readonly renderer: CliRenderer;
167
271
  readonly client: OpenCodeClient;
168
272
  readonly data: Data;
273
+ readonly attention: Attention;
274
+ readonly theme: any;
169
275
  readonly keymap: Keymap;
170
276
  readonly ui: UI;
171
277
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/plugin",
4
- "version": "0.0.0-next-16381",
4
+ "version": "0.0.0-next-16384",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -36,9 +36,9 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@ai-sdk/provider": "3.0.8",
39
- "@opencode-ai/ai": "0.0.0-next-16381",
40
- "@opencode-ai/client": "0.0.0-next-16381",
41
- "@opencode-ai/schema": "0.0.0-next-16381",
39
+ "@opencode-ai/ai": "0.0.0-next-16384",
40
+ "@opencode-ai/client": "0.0.0-next-16384",
41
+ "@opencode-ai/schema": "0.0.0-next-16384",
42
42
  "@opencode-ai/sdk": "1.18.5",
43
43
  "@standard-schema/spec": "1.1.0",
44
44
  "effect": "4.0.0-beta.101",