@ampcode/plugin 0.0.0-20261021001728-gcc084cc → 0.0.0-20261023001716-ge290a2a

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/index.d.ts +56 -3
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1578,6 +1578,36 @@ declare module '@ampcode/plugin' {
1578
1578
 
1579
1579
  /** Text for the confirm button (default: "Yes") */
1580
1580
  confirmButtonText?: string
1581
+
1582
+ /**
1583
+ * Start the dialog collapsed to its title and message with a button of this text, such as
1584
+ * `'Set Up'`, that expands it to the fields and the confirm and cancel buttons. Use it for a
1585
+ * dialog the user may want to read before taking on, such as connecting a service with
1586
+ * several fields. Clients with no collapsed state show the whole dialog at once.
1587
+ */
1588
+ expandButtonText?: string
1589
+
1590
+ /**
1591
+ * Markdown shown instead of `message` while the dialog is collapsed, such as a short pitch for
1592
+ * why the user should go ahead; `message` then holds the details shown with the fields. Only
1593
+ * used with `expandButtonText`.
1594
+ */
1595
+ collapsedMessage?: string
1596
+
1597
+ /**
1598
+ * HTTP or HTTPS URL of a small square image, such as a service's logo, shown before the
1599
+ * title. Clients without images ignore it.
1600
+ */
1601
+ iconURL?: string
1602
+
1603
+ /**
1604
+ * When the user declines this dialog while your tool's `execute` runs, end the agent's turn
1605
+ * once every tool call in the same batch has finished, instead of letting the agent
1606
+ * continue. Other calls and their dialogs are not cancelled. Ignored in hooks and commands.
1607
+ * Use this for approvals the agent must not work around, such as sending an email; do not
1608
+ * call `ctx.thread.cancel()` on decline, which stops every other call in the turn.
1609
+ */
1610
+ endTurnOnDecline?: boolean
1581
1611
  }
1582
1612
 
1583
1613
  /** A field shown in a confirmation dialog. */
@@ -1589,10 +1619,25 @@ declare module '@ampcode/plugin' {
1589
1619
  * can still confirm or cancel afterwards. Image and link fields are omitted from the
1590
1620
  * returned values. Defaults to `text`.
1591
1621
  *
1592
- * When a link field comes before a text field, clients show the fields as numbered steps:
1593
- * for example "open the sign-in page", then "paste the URL it ends on".
1622
+ * File fields take a small text file, such as a key or certificate, and return its text
1623
+ * in place of a typed value. The web client shows a drop zone that also opens the file
1624
+ * picker, with an option to paste the text instead; the CLI takes a path on this computer
1625
+ * or the pasted text. Files larger than 64 KiB or not valid UTF-8 are refused. A file
1626
+ * field is editable like a text field: it is required unless `optional`, and `secret`
1627
+ * applies to it.
1628
+ *
1629
+ * When a link field comes before an editable field, clients show the fields as numbered
1630
+ * steps: for example "open the sign-in page", then "paste the URL it ends on". When the
1631
+ * only field is one link, the user must open it before they can confirm: the primary
1632
+ * button opens the link, then becomes the confirm button.
1633
+ */
1634
+ type?: 'text' | 'image' | 'link' | 'file'
1635
+
1636
+ /**
1637
+ * File extensions a file field's picker offers, such as `['.p8']`. Advisory: the user can
1638
+ * still drop or paste any text.
1594
1639
  */
1595
- type?: 'text' | 'image' | 'link'
1640
+ accept?: string[]
1596
1641
 
1597
1642
  /** Stable key used in the returned record */
1598
1643
  name: string
@@ -2182,6 +2227,14 @@ declare module '@ampcode/plugin' {
2182
2227
 
2183
2228
  /** Current thread context for this tool invocation */
2184
2229
  thread: PluginThread
2230
+
2231
+ /**
2232
+ * Aborted when the tool call is cancelled, for example when the user presses Stop. The
2233
+ * tool's result is discarded after that, but the plugin keeps running, so check it before
2234
+ * starting an effect that cannot be undone, such as sending a message, and pass it to
2235
+ * APIs that accept an `AbortSignal`.
2236
+ */
2237
+ signal: AbortSignal
2185
2238
  }
2186
2239
 
2187
2240
  /** A provider-neutral webhook event delivered to a plugin handler. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampcode/plugin",
3
- "version": "0.0.0-20261021001728-gcc084cc",
3
+ "version": "0.0.0-20261023001716-ge290a2a",
4
4
  "description": "Amp Plugin API",
5
5
  "license": "Amp Commercial License",
6
6
  "homepage": "https://ampcode.com/docs/plugin-api",