@ampcode/plugin 0.0.0-20261022001600-ga727b26 → 0.0.0-20261024001616-ga5b55bc

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 +73 -45
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -420,19 +420,6 @@ declare module '@ampcode/plugin' {
420
420
  tools?: AgentToolSelection
421
421
  /** Optional reasoning effort override for models that support it. */
422
422
  reasoningEffort?: AgentReasoningEffort
423
- /**
424
- * Model and reasoning effort for the Oracle consulted from threads running this
425
- * agent. Omitted fields keep Amp's automatic routing and default effort. An
426
- * unavailable model falls back to Amp's routing at run time.
427
- */
428
- oracle?: AgentSubagentPin
429
- /**
430
- * Model and reasoning effort for the other subagents spawned from threads running
431
- * this agent (Task workers, finder, thread reader, librarian). Omitted fields keep
432
- * Amp's automatic routing and default effort. An unavailable model falls back to
433
- * Amp's routing at run time.
434
- */
435
- subagents?: AgentSubagentPin
436
423
  /**
437
424
  * Estimated input-token count at which Amp automatically compacts the thread.
438
425
  * Must be a positive safe integer. When omitted, Amp uses the configured
@@ -455,20 +442,6 @@ declare module '@ampcode/plugin' {
455
442
  display?: AgentDisplay
456
443
  }
457
444
 
458
- /**
459
- * A model pin for one subagent role of a custom agent: the Oracle or the other subagents.
460
- * Each field overrides independently.
461
- */
462
- export interface AgentSubagentPin {
463
- /**
464
- * Model identifier in `provider/model` format, such as `anthropic/claude-sonnet-4-6`.
465
- * Omit to keep Amp's automatic model routing for the role.
466
- */
467
- model?: PluginAgentModel
468
- /** Reasoning effort for the role's model. Omit to keep the role's default effort. */
469
- effort?: AgentReasoningEffort
470
- }
471
-
472
445
  /** Display metadata for a plugin agent. */
473
446
  export interface AgentDisplay {
474
447
  /** Label shown in mode pickers and thread headers, 24 characters or less. */
@@ -1578,6 +1551,36 @@ declare module '@ampcode/plugin' {
1578
1551
 
1579
1552
  /** Text for the confirm button (default: "Yes") */
1580
1553
  confirmButtonText?: string
1554
+
1555
+ /**
1556
+ * Start the dialog collapsed to its title and message with a button of this text, such as
1557
+ * `'Set Up'`, that expands it to the fields and the confirm and cancel buttons. Use it for a
1558
+ * dialog the user may want to read before taking on, such as connecting a service with
1559
+ * several fields. Clients with no collapsed state show the whole dialog at once.
1560
+ */
1561
+ expandButtonText?: string
1562
+
1563
+ /**
1564
+ * Markdown shown instead of `message` while the dialog is collapsed, such as a short pitch for
1565
+ * why the user should go ahead; `message` then holds the details shown with the fields. Only
1566
+ * used with `expandButtonText`.
1567
+ */
1568
+ collapsedMessage?: string
1569
+
1570
+ /**
1571
+ * HTTP or HTTPS URL of a small square image, such as a service's logo, shown before the
1572
+ * title. Clients without images ignore it.
1573
+ */
1574
+ iconURL?: string
1575
+
1576
+ /**
1577
+ * When the user declines this dialog while your tool's `execute` runs, end the agent's turn
1578
+ * once every tool call in the same batch has finished, instead of letting the agent
1579
+ * continue. Other calls and their dialogs are not cancelled. Ignored in hooks and commands.
1580
+ * Use this for approvals the agent must not work around, such as sending an email; do not
1581
+ * call `ctx.thread.cancel()` on decline, which stops every other call in the turn.
1582
+ */
1583
+ endTurnOnDecline?: boolean
1581
1584
  }
1582
1585
 
1583
1586
  /** A field shown in a confirmation dialog. */
@@ -1586,13 +1589,30 @@ declare module '@ampcode/plugin' {
1586
1589
  * How to show the field. Text fields are editable. Image fields show a read-only preview
1587
1590
  * of an HTTP(S) image URL. Link fields show a button that opens an HTTP(S) URL in the
1588
1591
  * browser, for example an approval page in another app; the dialog stays open so the user
1589
- * can still confirm or cancel afterwards. Image and link fields are omitted from the
1590
- * returned values. Defaults to `text`.
1592
+ * can still confirm or cancel afterwards. Attachment fields show a read-only card for the
1593
+ * file at an HTTP(S) URL, such as an email attachment: its name (`label`), type, and size,
1594
+ * with a preview where the client can render one. Image, link, and attachment fields are
1595
+ * omitted from the returned values unless they are `removable`. Defaults to `text`.
1591
1596
  *
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".
1597
+ * File fields take a small text file, such as a key or certificate, and return its text
1598
+ * in place of a typed value. The web client shows a drop zone that also opens the file
1599
+ * picker, with an option to paste the text instead; the CLI takes a path on this computer
1600
+ * or the pasted text. Files larger than 64 KiB or not valid UTF-8 are refused. A file
1601
+ * field is editable like a text field: it is required unless `optional`, and `secret`
1602
+ * applies to it.
1603
+ *
1604
+ * When a link field comes before an editable field, clients show the fields as numbered
1605
+ * steps: for example "open the sign-in page", then "paste the URL it ends on". When the
1606
+ * only field is one link, the user must open it before they can confirm: the primary
1607
+ * button opens the link, then becomes the confirm button.
1608
+ */
1609
+ type?: 'text' | 'image' | 'link' | 'file' | 'attachment'
1610
+
1611
+ /**
1612
+ * File extensions a file field's picker offers, such as `['.p8']`. Advisory: the user can
1613
+ * still drop or paste any text.
1594
1614
  */
1595
- type?: 'text' | 'image' | 'link'
1615
+ accept?: string[]
1596
1616
 
1597
1617
  /** Stable key used in the returned record */
1598
1618
  name: string
@@ -1606,6 +1626,19 @@ declare module '@ampcode/plugin' {
1606
1626
  /** Allow a text field to span multiple lines */
1607
1627
  multiline?: boolean
1608
1628
 
1629
+ /** The MIME type of an attachment field's file, such as `application/pdf`; picks its preview */
1630
+ mimeType?: string
1631
+
1632
+ /** The size in bytes of an attachment field's file, shown on its card */
1633
+ sizeBytes?: number
1634
+
1635
+ /**
1636
+ * Let the user remove an image or attachment field before confirming, for example an
1637
+ * attachment they do not want to send. The returned values then include the field: its
1638
+ * `value` when kept, or an empty string when removed.
1639
+ */
1640
+ removable?: boolean
1641
+
1609
1642
  /** Allow a text field to be left empty. Text fields are required unless this is set. */
1610
1643
  optional?: boolean
1611
1644
 
@@ -2182,6 +2215,14 @@ declare module '@ampcode/plugin' {
2182
2215
 
2183
2216
  /** Current thread context for this tool invocation */
2184
2217
  thread: PluginThread
2218
+
2219
+ /**
2220
+ * Aborted when the tool call is cancelled, for example when the user presses Stop. The
2221
+ * tool's result is discarded after that, but the plugin keeps running, so check it before
2222
+ * starting an effect that cannot be undone, such as sending a message, and pass it to
2223
+ * APIs that accept an `AbortSignal`.
2224
+ */
2225
+ signal: AbortSignal
2185
2226
  }
2186
2227
 
2187
2228
  /** A provider-neutral webhook event delivered to a plugin handler. */
@@ -2355,19 +2396,6 @@ declare module '@ampcode/plugin' {
2355
2396
  }
2356
2397
  /** Optional reasoning effort override for models that support it. */
2357
2398
  reasoningEffort?: AgentReasoningEffort
2358
- /**
2359
- * Model and reasoning effort for the Oracle consulted from threads running this
2360
- * agent. Omitted fields keep Amp's automatic routing and default effort. An
2361
- * unavailable model falls back to Amp's routing at run time.
2362
- */
2363
- oracle?: AgentSubagentPin
2364
- /**
2365
- * Model and reasoning effort for the other subagents spawned from threads running
2366
- * this agent (Task workers, finder, thread reader, librarian). Omitted fields keep
2367
- * Amp's automatic routing and default effort. An unavailable model falls back to
2368
- * Amp's routing at run time.
2369
- */
2370
- subagents?: AgentSubagentPin
2371
2399
  /** Features required on threads created from this agent. */
2372
2400
  features?: readonly AgentFeature[]
2373
2401
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampcode/plugin",
3
- "version": "0.0.0-20261022001600-ga727b26",
3
+ "version": "0.0.0-20261024001616-ga5b55bc",
4
4
  "description": "Amp Plugin API",
5
5
  "license": "Amp Commercial License",
6
6
  "homepage": "https://ampcode.com/docs/plugin-api",