@ampcode/plugin 0.0.0-20260512003045-g373e11b → 0.0.0-20260513003404-g32e421b
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 +57 -7
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ declare module '@ampcode/plugin' {
|
|
|
79
79
|
id: string,
|
|
80
80
|
options: PluginCommandOptions,
|
|
81
81
|
handler: (ctx: PluginCommandContext) => void | Promise<void>,
|
|
82
|
-
):
|
|
82
|
+
): CommandSubscription
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* Register a tool that the agent can call.
|
|
@@ -155,7 +155,12 @@ declare module '@ampcode/plugin' {
|
|
|
155
155
|
/** Text to show. */
|
|
156
156
|
text: string
|
|
157
157
|
|
|
158
|
-
/**
|
|
158
|
+
/**
|
|
159
|
+
* URL to open when clicked, if any.
|
|
160
|
+
*
|
|
161
|
+
* Use a `command:` URI to execute a command registered by a plugin or the
|
|
162
|
+
* command palette. For example, `command:foo` runs the command with ID `foo`.
|
|
163
|
+
*/
|
|
159
164
|
url?: string
|
|
160
165
|
}
|
|
161
166
|
|
|
@@ -219,6 +224,16 @@ declare module '@ampcode/plugin' {
|
|
|
219
224
|
*/
|
|
220
225
|
subscribe(observer: PluginConfigurationObserver<T>): Subscription
|
|
221
226
|
subscribe(onNext: (value: T) => void): Subscription
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Pipe operators for transforming this observable.
|
|
230
|
+
*/
|
|
231
|
+
pipe<Out>(op: (input: Observable<T>) => Out): Out
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Return this observable for interop with observable libraries.
|
|
235
|
+
*/
|
|
236
|
+
[Symbol.observable](): Observable<T>
|
|
222
237
|
}
|
|
223
238
|
|
|
224
239
|
/**
|
|
@@ -226,11 +241,6 @@ declare module '@ampcode/plugin' {
|
|
|
226
241
|
* Provides a limited subset of Observable functionality for plugins.
|
|
227
242
|
*/
|
|
228
243
|
export interface PluginConfiguration<T> extends Observable<T> {
|
|
229
|
-
/**
|
|
230
|
-
* Pipe operators for transforming the configuration observable.
|
|
231
|
-
*/
|
|
232
|
-
pipe<Out>(op: (input: PluginConfiguration<T>) => Out): Out
|
|
233
|
-
|
|
234
244
|
/**
|
|
235
245
|
* Get the current configuration value.
|
|
236
246
|
*/
|
|
@@ -460,6 +470,9 @@ declare module '@ampcode/plugin' {
|
|
|
460
470
|
/** Message body shown below the title */
|
|
461
471
|
message?: string
|
|
462
472
|
|
|
473
|
+
/** Initially selected option value */
|
|
474
|
+
initialValue?: string
|
|
475
|
+
|
|
463
476
|
/** Entries to display as choices */
|
|
464
477
|
options: string[]
|
|
465
478
|
}
|
|
@@ -790,6 +803,18 @@ declare module '@ampcode/plugin' {
|
|
|
790
803
|
*/
|
|
791
804
|
export type IsPluginUINotAvailableError = (error: Error) => boolean
|
|
792
805
|
|
|
806
|
+
/**
|
|
807
|
+
* Whether a registered command is selectable in the command palette.
|
|
808
|
+
*
|
|
809
|
+
* - `enabled`: shown and selectable.
|
|
810
|
+
* - `disabled`: shown but not selectable; `reason` is displayed alongside the command.
|
|
811
|
+
* - `hidden`: not shown in the palette at all.
|
|
812
|
+
*/
|
|
813
|
+
export type CommandAvailability =
|
|
814
|
+
| { type: 'enabled' }
|
|
815
|
+
| { type: 'disabled'; reason: string }
|
|
816
|
+
| { type: 'hidden' }
|
|
817
|
+
|
|
793
818
|
/**
|
|
794
819
|
* Options for registering a command.
|
|
795
820
|
*/
|
|
@@ -802,6 +827,31 @@ declare module '@ampcode/plugin' {
|
|
|
802
827
|
|
|
803
828
|
/** Human-readable description of what this command does */
|
|
804
829
|
description?: string
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* Initial availability of the command in the command palette.
|
|
833
|
+
* Defaults to `{ type: 'enabled' }`.
|
|
834
|
+
*
|
|
835
|
+
* Use the {@link CommandSubscription.setAvailability} method on the
|
|
836
|
+
* subscription returned by {@link PluginAPI.registerCommand} to update
|
|
837
|
+
* availability dynamically.
|
|
838
|
+
*/
|
|
839
|
+
availability?: CommandAvailability
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
* Subscription returned by {@link PluginAPI.registerCommand}.
|
|
844
|
+
*
|
|
845
|
+
* Allows updating the command's availability in the palette in addition to
|
|
846
|
+
* unregistering it.
|
|
847
|
+
*/
|
|
848
|
+
export interface CommandSubscription extends Subscription {
|
|
849
|
+
/**
|
|
850
|
+
* Update whether this command is selectable in the command palette.
|
|
851
|
+
* Triggers a refresh in the host so the palette reflects the new state
|
|
852
|
+
* on its next read.
|
|
853
|
+
*/
|
|
854
|
+
setAvailability(status: CommandAvailability): void
|
|
805
855
|
}
|
|
806
856
|
|
|
807
857
|
/**
|