@ampcode/plugin 0.0.0-20260922001754-ga9ffbd3 → 0.0.0-20260923001649-g009f5d9
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.
- package/index.d.ts +31 -9
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1270,10 +1270,25 @@ declare module '@ampcode/plugin' {
|
|
|
1270
1270
|
steer?: boolean
|
|
1271
1271
|
}
|
|
1272
1272
|
|
|
1273
|
+
/**
|
|
1274
|
+
* Options shared by the dialogs that wait for an answer (`ui.input`, `ui.confirm`, and
|
|
1275
|
+
* `ui.select`).
|
|
1276
|
+
*/
|
|
1277
|
+
export interface PluginDialogOptions {
|
|
1278
|
+
/**
|
|
1279
|
+
* Mark this dialog as one only the thread owner may answer in person. Without it, an agent
|
|
1280
|
+
* acting for the owner, such as a Puck thread that created and supervises this thread, may
|
|
1281
|
+
* be allowed to answer on the owner's behalf. Set this when the dialog is a deterministic
|
|
1282
|
+
* gate, such as a permission or approval prompt, so that only a human can pass it. Agents
|
|
1283
|
+
* can still see what the dialog asks. Secret inputs (`secret: true`) always require a human.
|
|
1284
|
+
*/
|
|
1285
|
+
requireHuman?: boolean
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1273
1288
|
/**
|
|
1274
1289
|
* Options for the input dialog.
|
|
1275
1290
|
*/
|
|
1276
|
-
export interface PluginInputOptions {
|
|
1291
|
+
export interface PluginInputOptions extends PluginDialogOptions {
|
|
1277
1292
|
/** Dialog title */
|
|
1278
1293
|
title?: string
|
|
1279
1294
|
|
|
@@ -1306,7 +1321,7 @@ declare module '@ampcode/plugin' {
|
|
|
1306
1321
|
/**
|
|
1307
1322
|
* Options for the confirm dialog.
|
|
1308
1323
|
*/
|
|
1309
|
-
export interface PluginConfirmOptions {
|
|
1324
|
+
export interface PluginConfirmOptions extends PluginDialogOptions {
|
|
1310
1325
|
/** Dialog title */
|
|
1311
1326
|
title: string
|
|
1312
1327
|
|
|
@@ -1317,21 +1332,27 @@ declare module '@ampcode/plugin' {
|
|
|
1317
1332
|
confirmButtonText?: string
|
|
1318
1333
|
}
|
|
1319
1334
|
|
|
1320
|
-
/**
|
|
1335
|
+
/** A field shown in a confirmation dialog. */
|
|
1321
1336
|
export interface PluginConfirmField {
|
|
1337
|
+
/**
|
|
1338
|
+
* How to show the field. Text fields are editable. Image fields show a read-only preview
|
|
1339
|
+
* of an HTTP(S) image URL and are omitted from the returned values. Defaults to `text`.
|
|
1340
|
+
*/
|
|
1341
|
+
type?: 'text' | 'image'
|
|
1342
|
+
|
|
1322
1343
|
/** Stable key used in the returned record */
|
|
1323
1344
|
name: string
|
|
1324
1345
|
|
|
1325
1346
|
/** Label shown above the field */
|
|
1326
1347
|
label: string
|
|
1327
1348
|
|
|
1328
|
-
/** Initial
|
|
1349
|
+
/** Initial text value or, for an image field, an HTTP(S) image URL */
|
|
1329
1350
|
value: string
|
|
1330
1351
|
|
|
1331
|
-
/** Allow
|
|
1352
|
+
/** Allow a text field to span multiple lines */
|
|
1332
1353
|
multiline?: boolean
|
|
1333
1354
|
|
|
1334
|
-
/** Allow
|
|
1355
|
+
/** Allow a text field to be left empty. Text fields are required unless this is set. */
|
|
1335
1356
|
optional?: boolean
|
|
1336
1357
|
}
|
|
1337
1358
|
|
|
@@ -1343,7 +1364,7 @@ declare module '@ampcode/plugin' {
|
|
|
1343
1364
|
/**
|
|
1344
1365
|
* Options for the select dialog.
|
|
1345
1366
|
*/
|
|
1346
|
-
export interface PluginSelectOptions {
|
|
1367
|
+
export interface PluginSelectOptions extends PluginDialogOptions {
|
|
1347
1368
|
/** Dialog title */
|
|
1348
1369
|
title: string
|
|
1349
1370
|
|
|
@@ -1376,8 +1397,9 @@ declare module '@ampcode/plugin' {
|
|
|
1376
1397
|
input(options: PluginInputOptions): Promise<string | undefined>
|
|
1377
1398
|
|
|
1378
1399
|
/**
|
|
1379
|
-
* Show
|
|
1380
|
-
* @returns The edited values by field name, or undefined if cancelled.
|
|
1400
|
+
* Show editable text fields and read-only image previews in a confirmation dialog.
|
|
1401
|
+
* @returns The edited text values by field name, or undefined if cancelled. Image fields
|
|
1402
|
+
* are omitted.
|
|
1381
1403
|
*/
|
|
1382
1404
|
confirm(options: PluginEditableConfirmOptions): Promise<Record<string, string> | undefined>
|
|
1383
1405
|
/**
|