@ampcode/plugin 0.0.0-20261107001010-g21afa79 → 0.0.0-20261109001254-g196b1f0

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 (2) hide show
  1. package/omni.d.ts +431 -30
  2. package/package.json +1 -1
package/omni.d.ts CHANGED
@@ -1,11 +1,21 @@
1
1
  declare module '@ampcode/plugin/omni' {
2
2
  import type {
3
+ AgentEndEvent,
4
+ AgentEndResult,
5
+ AgentStartEvent,
6
+ AgentStartResult,
7
+ AppendUserMessageOptions,
3
8
  CustomAgentDefinition,
4
9
  defineAgent as defineAgentHelper,
5
10
  Observable,
6
11
  PluginAgentModeDefinition,
7
12
  PluginLogger,
13
+ QuickActionArgs,
14
+ QuickActionIcon,
15
+ SessionStartEvent,
8
16
  Subscription,
17
+ ThreadMessage,
18
+ UserMessage,
9
19
  WebhookEvent,
10
20
  WebhookRegistration,
11
21
  } from '@ampcode/plugin'
@@ -24,10 +34,13 @@ declare module '@ampcode/plugin/omni' {
24
34
  * import type { OmniPluginAPI } from '@ampcode/plugin/omni'
25
35
  *
26
36
  * export default function (amp: OmniPluginAPI) {
27
- * amp.registerCommand('ship', { title: 'ship', category: 'git' }, async (ctx) => {
28
- * if (!ctx.window) return
29
- * await ctx.window.insertPromptText('Ship this thread: commit, push, and report CI.')
37
+ * amp.registerCommand('acme.ship', {
38
+ * title: 'Ship',
39
+ * group: 'Git',
40
+ * action: 'send-message',
41
+ * args: { message: 'Ship this thread: commit, push, and report CI.' },
30
42
  * })
43
+ * amp.ui.quickActions.addButton('acme.ship', { when: { working: false, hasChanges: true } })
31
44
  * }
32
45
  * ```
33
46
  *
@@ -137,48 +150,236 @@ declare module '@ampcode/plugin/omni' {
137
150
 
138
151
  /**
139
152
  * Adds a command to the command palette of every client the user is signed in to, on
140
- * every page, not only inside a thread. Users can bind a keyboard shortcut to it in their
141
- * keymap settings. When the user picks the command, the actor runs this plugin's default
142
- * export again in a fresh sandbox and then the handler, as it does for webhook
143
- * deliveries, so initialize in the default export and do not rely on state captured
144
- * between runs. The window they picked it in is `ctx.window`.
153
+ * every page, not only inside a thread. Users can bind a keyboard shortcut to it in
154
+ * their keymap settings. To also show a button for it in a thread, place it with
155
+ * {@link OmniPluginAPI.ui} after registering it.
145
156
  *
146
- * The same shape as `PluginAPI.registerCommand`, with the options and context an omni
147
- * plugin can use. A plugin may register at most 50 commands, and registering an ID that
148
- * is still registered throws.
157
+ * What picking the command does is its `action`. A declarative action (`'open-url'`,
158
+ * `'send-message'`, `'copy'`, `'open-pane'`, `'open-portal'`) is performed by the client
159
+ * itself, at once, with no round trip to the plugin: a link button is a real link that
160
+ * ⌘-click opens in a new tab, and a right-click on a message button lists Send and Edit
161
+ * Before Sending. With `action: 'call'`, picking the command calls `call` on the actor:
162
+ * the actor runs this plugin's default export again in a fresh sandbox and then calls
163
+ * `call`, as it does for webhook deliveries, so initialize in the default export and do
164
+ * not rely on state captured between runs. The window the user picked it in is
165
+ * `ctx.window`.
149
166
  *
150
- * @param id - Unique within this plugin, such as `'ship'`.
167
+ * A plugin may register at most 50 commands, and registering an ID that is still
168
+ * registered throws.
169
+ *
170
+ * @param id - The command's ID, `namespace.name` as in VS Code: two or more
171
+ * dot-separated segments of letters, digits, and hyphens, such as `'acme.ship'` or
172
+ * `'acme.review.changes'`. The namespace is a name the plugin picks for itself, so its
173
+ * commands read as a family in keymaps and logs; it need not match the plugin file or
174
+ * workspace name. IDs are unique within this plugin.
175
+ *
176
+ * @example
177
+ * ```ts
178
+ * amp.registerCommand('acme.standup', {
179
+ * title: 'Draft Standup',
180
+ * group: 'Team',
181
+ * action: 'call',
182
+ * call: async (ctx) => {
183
+ * if (!ctx.window) return
184
+ * await ctx.window.insertPromptText('Draft my standup update from yesterday’s threads.')
185
+ * await ctx.ui.notify('Standup prompt inserted')
186
+ * },
187
+ * })
188
+ * amp.registerCommand('acme.dashboard', {
189
+ * title: 'Open Dashboard',
190
+ * icon: 'activity',
191
+ * action: 'open-url',
192
+ * args: { url: 'https://example.com/dashboard' },
193
+ * })
194
+ * amp.ui.threadMenu.addItem('acme.dashboard')
195
+ * amp.ui.threadTitleBar.addButton('acme.dashboard', { title: 'Dashboard' })
196
+ * ```
197
+ */
198
+ registerCommand(id: string, options: OmniPluginCommandOptions): OmniPluginSubscription
199
+
200
+ /**
201
+ * Subscribes a handler to an agent hook on every thread the user owns. The hook names,
202
+ * event payloads, and handler results are the executor plugin API's (`amp.on()` in
203
+ * `@ampcode/plugin`), so a handler written for an executor plugin runs unchanged here:
204
+ * `session.start` once per thread, `agent.start` when a user message starts a turn, and
205
+ * `agent.end` when the turn settles. An `agent.start` handler may return
206
+ * `{ message }` to add context to the turn, and an `agent.end` handler may return
207
+ * `{ action: 'continue', userMessage }` to start another turn.
208
+ *
209
+ * The thread runs these hooks itself, right after it ran the same hook of the executor
210
+ * plugins, whether or not it has an executor. Each hook runs this plugin's default export
211
+ * again in a fresh sandbox and then calls the handler, as commands do, so initialize in
212
+ * the default export. Handlers get {@link OmniPluginEventContext}: the thread's
213
+ * transcript and `ctx.ui` dialogs that show on the thread, in every window that has it
214
+ * open, rather than in one window. Several subscribed plugins run one after the other;
215
+ * the first `agent.end` handler that asks to continue wins, after the executor's. A
216
+ * handler that throws is logged and does not affect the turn.
151
217
  *
152
218
  * @example
153
219
  * ```ts
154
- * amp.registerCommand('standup', { title: 'draft standup', category: 'team' }, async (ctx) => {
155
- * if (!ctx.window) return
156
- * await ctx.window.insertPromptText('Draft my standup update from yesterday’s threads.')
157
- * await ctx.ui.notify('Standup prompt inserted')
220
+ * amp.on('agent.end', async (event, ctx) => {
221
+ * if (event.status !== 'error') return
222
+ * const retry = await ctx.ui.confirm({ title: 'The turn failed. Retry it?' })
223
+ * if (retry) return { action: 'continue', userMessage: 'Try again' }
158
224
  * })
159
225
  * ```
160
226
  */
161
- registerCommand(
162
- id: string,
163
- options: OmniPluginCommandOptions,
164
- handler: (ctx: OmniPluginCommandContext) => void | Promise<void>,
165
- ): OmniPluginCommandSubscription
227
+ on<E extends keyof OmniPluginThreadEventMap>(
228
+ event: E,
229
+ handler: (
230
+ event: OmniPluginThreadEventMap[E],
231
+ ctx: OmniPluginEventContext,
232
+ ) => OmniPluginThreadEventResultMap[E] | Promise<OmniPluginThreadEventResultMap[E]>,
233
+ ): OmniPluginSubscription
234
+
235
+ /**
236
+ * Where a registered command can show a button besides the command palette. Each
237
+ * surface has its own call, with the options that surface understands; a command may be
238
+ * placed once on each. Every button shows the command's `icon` and, unless the
239
+ * placement gives its own, its `title`; hovering names the plugin and shows
240
+ * `description`. A button runs the command with its thread as `ctx.thread`: the thread
241
+ * whose title bar, menu, or composer it is in, which need not be the page's.
242
+ *
243
+ * Place a command after registering it; placing an unregistered command throws, and
244
+ * unregistering a command removes its placements. Each call returns a subscription that
245
+ * removes only that placement.
246
+ */
247
+ ui: OmniPluginUI
248
+ }
249
+
250
+ /** The surfaces {@link OmniPluginAPI.ui} places commands on. */
251
+ export interface OmniPluginUI {
252
+ /** A button at the end of the thread's title bar, after Amp's own controls. */
253
+ threadTitleBar: {
254
+ addButton(command: string, options?: OmniPluginTitleBarButtonOptions): OmniPluginSubscription
255
+ }
256
+ /**
257
+ * A row in every menu that acts on a thread: the title bar's `⋯` menu and the sidebar
258
+ * row's right-click or long-press menu. One placement fills them all; a sidebar row's
259
+ * item acts on that row's thread.
260
+ */
261
+ threadMenu: {
262
+ addItem(command: string, options?: OmniPluginThreadMenuItemOptions): OmniPluginSubscription
263
+ }
264
+ /**
265
+ * A capsule in the quick action row above the composer, after the executor plugins'
266
+ * quick actions. `when` decides on which threads it shows.
267
+ */
268
+ quickActions: {
269
+ addButton(command: string, options?: OmniPluginQuickActionOptions): OmniPluginSubscription
270
+ }
271
+ }
272
+
273
+ /** Options for {@link OmniPluginUI.threadTitleBar}. */
274
+ export interface OmniPluginTitleBarButtonOptions {
275
+ /**
276
+ * The button's text instead of the command's `title`, such as a shorter `'Dashboard'`
277
+ * for `'Open Dashboard'`. The tooltip and the palette keep the command's `title`.
278
+ */
279
+ title?: string
280
+ /** Show only the icon, and keep the title for the tooltip. */
281
+ iconOnly?: boolean
282
+ }
283
+
284
+ /** Options for {@link OmniPluginUI.threadMenu}. */
285
+ export interface OmniPluginThreadMenuItemOptions {
286
+ /** The row's text instead of the command's `title`. */
287
+ title?: string
288
+ }
289
+
290
+ /** Options for {@link OmniPluginUI.quickActions}. */
291
+ export interface OmniPluginQuickActionOptions {
292
+ /** The capsule's text instead of the command's `title`. */
293
+ title?: string
294
+ /**
295
+ * What the thread must be for the capsule to show. Each key given must match; an
296
+ * omitted key does not restrict. Without `when`, the capsule shows on every thread.
297
+ */
298
+ when?: OmniPluginQuickActionCriteria
299
+ }
300
+
301
+ /**
302
+ * Facts about a thread a quick action placement can require
303
+ * ({@link OmniPluginQuickActionOptions.when}). The web client evaluates them as the thread
304
+ * changes, so a capsule appears and disappears with the thread's state.
305
+ */
306
+ export interface OmniPluginQuickActionCriteria {
307
+ /** `true`: only while an agent turn is running; `false`: only while the agent is idle. */
308
+ working?: boolean
309
+ /**
310
+ * `true`: only when the thread's workspace has uncommitted, unlanded, or unpushed
311
+ * changes; `false`: only when it has none.
312
+ */
313
+ hasChanges?: boolean
166
314
  }
167
315
 
168
- /** Options for {@link OmniPluginAPI.registerCommand}. */
169
- export interface OmniPluginCommandOptions {
170
- /** The title shown after the colon in the command palette (e.g., "Greet" in "Hello: Greet") */
316
+ /**
317
+ * Options for {@link OmniPluginAPI.registerCommand}: how the command is listed, and what
318
+ * picking it does ({@link OmniPluginCommandAction}).
319
+ */
320
+ export type OmniPluginCommandOptions = OmniPluginCommandListing & OmniPluginCommandAction
321
+
322
+ /** How a command is listed in the palette and shown on the buttons placed for it. */
323
+ export interface OmniPluginCommandListing {
324
+ /**
325
+ * The command's name everywhere it shows: the command palette, each button placed for
326
+ * it, and the button's tooltip, such as `'Ship'`. A placement can show a different text
327
+ * with its own `title` option.
328
+ */
171
329
  title: string
172
330
 
173
- /** The category shown before the colon (e.g., "Hello" in "Hello: Greet"). Defaults to the plugin name. */
174
- category?: string
331
+ /**
332
+ * The command palette group the command is listed under, such as `'Git'`. A group that
333
+ * no other command uses is created for it, after Amp's own groups. Defaults to the
334
+ * plugin name.
335
+ */
336
+ group?: string
175
337
 
176
338
  /** Human-readable description of what this command does */
177
339
  description?: string
340
+
341
+ /**
342
+ * The icon the buttons placed for the command show, named as in Lucide. Without one, the
343
+ * button shows the action's icon, or for `open-pane`, the pane's icon.
344
+ */
345
+ icon?: QuickActionIcon
178
346
  }
179
347
 
180
- /** Returned by {@link OmniPluginAPI.registerCommand}; `unsubscribe()` removes the command. */
181
- export interface OmniPluginCommandSubscription {
348
+ /**
349
+ * The declarative actions a command can declare instead of running code. The client
350
+ * performs each itself: see `QuickActionArgs` in `@ampcode/plugin` for what each does.
351
+ * `send-message` needs a thread: from a placed button it is the button's thread, from the
352
+ * palette the thread on screen; the CLI puts the message in the composer instead of sending
353
+ * it. `open-pane` and `open-portal` need a thread page in the web or an app. Text is
354
+ * limited to 10,000 characters.
355
+ */
356
+ export type OmniPluginCommandActionName =
357
+ | 'send-message'
358
+ | 'open-url'
359
+ | 'copy'
360
+ | 'open-pane'
361
+ | 'open-portal'
362
+
363
+ /**
364
+ * What picking a command does: `call` calls a function on the actor, with
365
+ * {@link OmniPluginCommandContext}; the others are declarative, and the client performs
366
+ * them itself.
367
+ */
368
+ export type OmniPluginCommandAction =
369
+ | {
370
+ action: 'call'
371
+ /** Called on the actor each time the user picks the command. */
372
+ call: (ctx: OmniPluginCommandContext) => void | Promise<void>
373
+ }
374
+ | {
375
+ [A in OmniPluginCommandActionName]: { action: A; args: QuickActionArgs[A] }
376
+ }[OmniPluginCommandActionName]
377
+
378
+ /**
379
+ * Returned by {@link OmniPluginAPI.registerCommand} and the {@link OmniPluginAPI.ui} calls;
380
+ * `unsubscribe()` removes the command or the placement.
381
+ */
382
+ export interface OmniPluginSubscription {
182
383
  unsubscribe(): void
183
384
  }
184
385
 
@@ -203,13 +404,212 @@ declare module '@ampcode/plugin/omni' {
203
404
  * showed another page or there is no window. Text the command inserts goes to that
204
405
  * thread's prompt editor; if the window has moved to another thread, the text is dropped.
205
406
  */
206
- thread?: { id: string }
407
+ thread?: OmniPluginCommandThread
408
+ }
409
+
410
+ /**
411
+ * The agent hooks {@link OmniPluginAPI.on} delivers, by name, with the executor plugin
412
+ * API's payloads (`PluginEventMap` in `@ampcode/plugin`).
413
+ */
414
+ export interface OmniPluginThreadEventMap {
415
+ /** The thread's first turn is starting; fires once per thread. */
416
+ 'session.start': SessionStartEvent
417
+ /** A user message started a turn. */
418
+ 'agent.start': AgentStartEvent
419
+ /** The turn settled: `status` is `done`, `error`, or `cancelled`, with the turn's messages. */
420
+ 'agent.end': AgentEndEvent
421
+ }
422
+
423
+ /**
424
+ * What a handler may return for each hook, as the executor plugin API's
425
+ * `PluginRequestResultMap`. Return nothing to leave the turn as it is. An `agent.start`
426
+ * `message.content` is at most 16,000 characters and an `agent.end` `userMessage` at most
427
+ * 16,000 characters; a result outside the shape is logged and dropped.
428
+ */
429
+ export interface OmniPluginThreadEventResultMap {
430
+ 'session.start': void
431
+ 'agent.start': AgentStartResult | void
432
+ 'agent.end': AgentEndResult
433
+ }
434
+
435
+ /**
436
+ * Context passed to an {@link OmniPluginAPI.on} handler. A hook runs on the thread, not in
437
+ * a window, so there is no prompt editor to insert into and no page to show, and the
438
+ * dialogs show on the thread.
439
+ */
440
+ export interface OmniPluginEventContext {
441
+ /** Logger scoped to this plugin. */
442
+ logger: PluginLogger
443
+
444
+ /**
445
+ * Dialogs shown on the thread, as an executor plugin's `ctx.ui` dialogs are: every
446
+ * window with the thread open shows the question, the first answer settles it, and it
447
+ * resolves as dismissed after 5 minutes without one. `notify` reaches every window the
448
+ * user has open. `show` is only for commands and throws here.
449
+ */
450
+ ui: Omit<OmniPluginCommandUI, 'show'>
451
+
452
+ /**
453
+ * The thread the hook runs on. `messages()` reads the live transcript, including the
454
+ * turn in progress, and `appendUserMessage()` is accepted by the thread directly; both
455
+ * otherwise work as in {@link OmniPluginCommandThread}.
456
+ */
457
+ thread: Pick<OmniPluginCommandThread, 'id' | 'messages' | 'appendUserMessage'> & {
458
+ /** The thread's title, or `null` when it has none yet. */
459
+ title: string | null
460
+ }
461
+ }
462
+
463
+ /** The thread a command ran on, with access to its transcript. */
464
+ export interface OmniPluginCommandThread {
465
+ id: string
466
+
467
+ /**
468
+ * Reads a page of this thread's stored messages in the same plugin-facing schema as
469
+ * executor plugins' `amp.thread.messages()`. The read goes to the Amp service, so it is
470
+ * always asynchronous and needs the user to still be able to view the thread.
471
+ *
472
+ * Defaults to `{ from: 'end', offset: 0, limit: 10 }`. `limit` is at most 20 and
473
+ * `offset` at most 200; a page whose JSON exceeds 256,000 characters rejects instead of
474
+ * truncating, so read smaller pages of threads with large tool results. Unlike the
475
+ * executor API there is no `full` option: the read always covers the stored transcript,
476
+ * and assistant messages never report `stopReason: 'end_turn'`.
477
+ *
478
+ * Known limitation: the read sees the thread as last synced to the Amp service, not the
479
+ * live transcript. While a turn is running, the assistant message being streamed and the
480
+ * tool call in progress are absent until that step finishes, and each finished step takes
481
+ * up to about 10 more seconds to arrive. Between turns the stored transcript is complete.
482
+ *
483
+ * ```ts
484
+ * const [last] = await ctx.thread.messages({ limit: 1 })
485
+ * ```
486
+ */
487
+ messages(options?: OmniPluginThreadMessagesOptions): Promise<ThreadMessage[]>
488
+
489
+ /**
490
+ * Appends a user message to this thread, with the same arguments as executor plugins'
491
+ * `amp.thread.appendUserMessage()`. The message starts a turn as if the user had sent it
492
+ * and the transcript shows it as sent by this plugin. Only the thread's owner can send,
493
+ * so this fails on a thread shared with the user. `content` is at most 16,000 characters.
494
+ * Resolves once the thread has accepted the message, before the agent answers.
495
+ *
496
+ * When `steer` is true and the thread is busy, the message is queued as a steering
497
+ * message and is preferred when the thread next dequeues work.
498
+ *
499
+ * A message sent from an `agent.end` handler starts another turn, which ends with another
500
+ * `agent.end`; check the thread's last messages before sending so a plugin does not keep a
501
+ * thread running on its own.
502
+ *
503
+ * ```ts
504
+ * await ctx.thread.appendUserMessage({ type: 'user-message', content: 'Run the tests' })
505
+ * ```
506
+ */
507
+ appendUserMessage(message: UserMessage, options?: AppendUserMessageOptions): Promise<void>
508
+ }
509
+
510
+ /** Options for {@link OmniPluginCommandThread.messages}. Unknown keys are rejected. */
511
+ export interface OmniPluginThreadMessagesOptions {
512
+ /** Which end of the transcript to page from. Defaults to `end`. */
513
+ from?: 'start' | 'end'
514
+ /** How many messages to skip from `from`, at most 200. Defaults to 0. */
515
+ offset?: number
516
+ /** How many messages to read, at most 20. Defaults to 10. */
517
+ limit?: number
207
518
  }
208
519
 
209
- /** UI calls available to an omni plugin command. */
520
+ /**
521
+ * UI calls available to an omni plugin command. The dialogs show in the window the user ran
522
+ * the command in and resolve with the user's answer. The command's 30 s run limit pauses
523
+ * while a dialog is open; one run may wait at most 5 minutes in total for answers, after
524
+ * which the open dialog resolves as dismissed. Text in options is limited to 4000
525
+ * characters and a select to 50 options; unknown option keys fail the call.
526
+ *
527
+ * ```ts
528
+ * const target = await ctx.ui.select({ title: 'Deploy to', options: ['staging', 'prod'] })
529
+ * if (target && (await ctx.ui.confirm({ title: `Deploy to ${target}?` }))) {
530
+ * await ctx.window.insertPromptText(`Deploy to ${target}`)
531
+ * }
532
+ * ```
533
+ */
210
534
  export interface OmniPluginCommandUI {
211
535
  /** Shows a short notification (a toast) in the window the user ran the command in. */
212
536
  notify(message: string): Promise<void>
537
+ /** Asks the user for a line of text; `undefined` when they dismiss the dialog. */
538
+ input(options?: OmniPluginInputOptions): Promise<string | undefined>
539
+ /** Asks the user a yes-or-no question; `false` when they dismiss the dialog. */
540
+ confirm(options: OmniPluginConfirmOptions): Promise<boolean>
541
+ /** Asks the user to pick one option; `undefined` when they dismiss the dialog. */
542
+ select(options: OmniPluginSelectOptions): Promise<string | undefined>
543
+ /**
544
+ * Shows Markdown or an embedded HTTPS page in a dialog titled `title`. Resolves
545
+ * when the user closes it, with `undefined`, or when the embedded page posts a result
546
+ * (see {@link OmniPluginShowOptions.url}), with that result. Clients that cannot embed a
547
+ * page, such as the CLI, offer to open the URL in the browser and resolve `undefined`.
548
+ *
549
+ * @example
550
+ * ```ts
551
+ * const report = buildReport(await ctx.thread.messages({ limit: 20 }))
552
+ * await ctx.ui.show({ title: 'Thread report', markdown: report })
553
+ *
554
+ * const picked = await ctx.ui.show({ title: 'Pick a ticket', url: 'https://tickets.example/pick' })
555
+ * if (typeof picked === 'string') await ctx.window.insertPromptText(`Work on ${picked}`)
556
+ * ```
557
+ */
558
+ show(options: OmniPluginShowOptions): Promise<unknown>
559
+ }
560
+
561
+ /**
562
+ * Options for {@link OmniPluginCommandUI.show}. Give exactly one of `markdown` and `url`.
563
+ */
564
+ export interface OmniPluginShowOptions {
565
+ title: string
566
+ /** Markdown body, at most 16,000 characters. */
567
+ markdown?: string
568
+ /**
569
+ * HTTPS page to embed in an iframe, at most 2,048 characters. The page runs with scripts,
570
+ * forms, and its own origin's storage. To close the dialog with a result, it posts
571
+ * `{ type: 'amp-plugin-dialog-result', value }` to `window.parent`, where `value` is any
572
+ * JSON of at most 16,000 characters; a `null` value closes without a result. Only messages
573
+ * from the page's own origin count. Pages that forbid framing (`X-Frame-Options`,
574
+ * `frame-ancestors`) show blank.
575
+ */
576
+ url?: string
577
+ }
578
+
579
+ /** Options for {@link OmniPluginCommandUI.input}; the executor API's options minus thread-bound ones. */
580
+ export interface OmniPluginInputOptions {
581
+ title?: string
582
+ /** Help text shown below the title. */
583
+ helpText?: string
584
+ /** Initial text in the field. Not allowed with `secret`. */
585
+ initialValue?: string
586
+ submitButtonText?: string
587
+ placeholder?: string
588
+ /** Clients mask or hide the text, and it is not logged. */
589
+ secret?: boolean
590
+ /** Stable field name password managers recognize, such as `OPENAI_API_KEY`. */
591
+ fieldName?: string
592
+ }
593
+
594
+ /** Options for {@link OmniPluginCommandUI.confirm}. */
595
+ export interface OmniPluginConfirmOptions {
596
+ title: string
597
+ /** Markdown shown below the title. */
598
+ message?: string
599
+ /** Text for the confirm button (default: "Yes"). */
600
+ confirmButtonText?: string
601
+ }
602
+
603
+ /** Options for {@link OmniPluginCommandUI.select}. */
604
+ export interface OmniPluginSelectOptions {
605
+ title: string
606
+ /** Markdown shown below the title. */
607
+ message?: string
608
+ /** The choices, at most 50. */
609
+ options: string[]
610
+ initialValue?: string
611
+ /** Adds a free-text "Other" field whose trimmed value is returned like a choice. */
612
+ allowOther?: boolean
213
613
  }
214
614
 
215
615
  /** The window a command runs in, with what the command can ask of it. */
@@ -230,6 +630,7 @@ declare module '@ampcode/plugin/omni' {
230
630
  export const clients: OmniPluginAPI['clients']
231
631
  export const events: OmniPluginAPI['events']
232
632
  export const tools: OmniPluginAPI['tools']
633
+ export const ui: OmniPluginAPI['ui']
233
634
 
234
635
  /** Context a webhook or event handler receives on its Puck or Space host. */
235
636
  export interface OmniPluginHandlerContext {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampcode/plugin",
3
- "version": "0.0.0-20261107001010-g21afa79",
3
+ "version": "0.0.0-20261109001254-g196b1f0",
4
4
  "description": "Amp Plugin API",
5
5
  "license": "Amp Commercial License",
6
6
  "homepage": "https://ampcode.com/docs/plugin-api",