@ampcode/plugin 0.0.0-20260425002358-g58772b5 → 0.0.0-20260426002548-gff4795b
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 +28 -2
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -289,7 +289,7 @@ declare module '@ampcode/plugin' {
|
|
|
289
289
|
export interface ThreadToolResultBlock {
|
|
290
290
|
type: 'tool_result'
|
|
291
291
|
toolUseID: string
|
|
292
|
-
output?:
|
|
292
|
+
output?: PluginToolResult
|
|
293
293
|
status: 'done' | 'error' | 'cancelled' | 'running' | 'pending'
|
|
294
294
|
}
|
|
295
295
|
|
|
@@ -491,6 +491,29 @@ declare module '@ampcode/plugin' {
|
|
|
491
491
|
output?: unknown
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
+
/**
|
|
495
|
+
* A structured content block returned from a plugin tool.
|
|
496
|
+
*/
|
|
497
|
+
export type PluginToolResultContentBlock =
|
|
498
|
+
| { type: 'text'; text: string }
|
|
499
|
+
| {
|
|
500
|
+
type: 'image'
|
|
501
|
+
|
|
502
|
+
/** MIME type, e.g. 'image/png', 'image/jpeg', or 'image/webp'. */
|
|
503
|
+
mimeType: string
|
|
504
|
+
|
|
505
|
+
/** Base64-encoded payload with no data: prefix. */
|
|
506
|
+
data: string
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Result returned from a plugin tool.
|
|
511
|
+
*
|
|
512
|
+
* Returning a bare string keeps the existing text-only behavior. Returning an array
|
|
513
|
+
* of content blocks lets a tool mix text and inline base64 image blocks.
|
|
514
|
+
*/
|
|
515
|
+
export type PluginToolResult = string | PluginToolResultContentBlock[]
|
|
516
|
+
|
|
494
517
|
/**
|
|
495
518
|
* Event payload for tool.result event.
|
|
496
519
|
*/
|
|
@@ -736,6 +759,9 @@ declare module '@ampcode/plugin' {
|
|
|
736
759
|
}
|
|
737
760
|
|
|
738
761
|
/** Execute the tool with the given input and return a result */
|
|
739
|
-
execute: (
|
|
762
|
+
execute: (
|
|
763
|
+
input: Record<string, unknown>,
|
|
764
|
+
ctx: PluginToolContext,
|
|
765
|
+
) => Promise<PluginToolResult | void>
|
|
740
766
|
}
|
|
741
767
|
}
|