@ampcode/plugin 0.0.0-20260617025830-g1078551 → 0.0.0-20260619033929-g5bbf05d
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 +40 -3
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -111,9 +111,47 @@ declare module '@ampcode/plugin' {
|
|
|
111
111
|
/** AI helpers */
|
|
112
112
|
ai: PluginAI
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Create a custom agent bound to this plugin runtime.
|
|
116
|
+
*
|
|
117
|
+
* Run `amp plugins show-agent-options` or `amp plugins show-agent-options --json` to
|
|
118
|
+
* discover public model IDs and built-in tool names that are suitable for plugin agents.
|
|
119
|
+
*/
|
|
120
|
+
createAgent(config: CreateAgentConfig): Agent
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get an agent handle for one of Amp's built-in agent modes (`smart`,
|
|
124
|
+
* `deep`, or `rush`). Threads spawned from the handle run the built-in
|
|
125
|
+
* mode's prompt and tools, like a thread the user started in that mode.
|
|
126
|
+
*/
|
|
127
|
+
getBuiltinAgent(mode: BuiltinAgentMode, options?: GetBuiltinAgentOptions): Agent
|
|
128
|
+
|
|
129
|
+
/** Register a custom agent mode that clients may show alongside built-in modes. */
|
|
130
|
+
registerAgentMode(definition: PluginAgentModeDefinition): Subscription
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Observable that emits the currently active thread (the one the user is focused on
|
|
134
|
+
* in the UI), or `null` when no thread is active.
|
|
135
|
+
*
|
|
136
|
+
* Use this to determine whether the thread that triggered an event is the one the user
|
|
137
|
+
* is currently looking at, or is running in the background. For example, in a
|
|
138
|
+
* `tool.call` handler, compare `event.thread.id` to `amp.activeThread.current` to
|
|
139
|
+
* decide whether to surface a UI prompt (active) or take a non-interactive default
|
|
140
|
+
* (background).
|
|
141
|
+
*/
|
|
142
|
+
activeThread: Observable<{ id: ThreadID } | null> & {
|
|
143
|
+
readonly current: { id: ThreadID } | null
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Thread lookup APIs. */
|
|
147
|
+
threads: PluginThreads
|
|
148
|
+
|
|
114
149
|
/**
|
|
115
150
|
* Experimental plugin APIs that are not stable and may change or be removed.
|
|
116
151
|
*
|
|
152
|
+
* Prefer the first-class top-level APIs when available. Migrated APIs remain
|
|
153
|
+
* here as compatibility aliases for existing plugins.
|
|
154
|
+
*
|
|
117
155
|
* Agents should only build on these APIs when the user explicitly approves the
|
|
118
156
|
* use of experimental Amp plugin APIs.
|
|
119
157
|
*/
|
|
@@ -156,7 +194,7 @@ declare module '@ampcode/plugin' {
|
|
|
156
194
|
* Use this to determine whether the thread that triggered an event is the one the user
|
|
157
195
|
* is currently looking at, or is running in the background. For example, in a
|
|
158
196
|
* `tool.call` handler, compare `event.thread.id` to
|
|
159
|
-
* `amp.
|
|
197
|
+
* `amp.activeThread.current` to decide whether to surface a UI prompt
|
|
160
198
|
* (active) or take a non-interactive default (background).
|
|
161
199
|
*/
|
|
162
200
|
activeThread: Observable<{ id: ThreadID } | null> & {
|
|
@@ -278,8 +316,7 @@ declare module '@ampcode/plugin' {
|
|
|
278
316
|
|
|
279
317
|
/**
|
|
280
318
|
* A handle to a custom or built-in agent, returned by
|
|
281
|
-
* {@link
|
|
282
|
-
* {@link ExperimentalPluginAPI.getBuiltinAgent}.
|
|
319
|
+
* {@link PluginAPI.createAgent} and {@link PluginAPI.getBuiltinAgent}.
|
|
283
320
|
*/
|
|
284
321
|
export interface Agent {
|
|
285
322
|
readonly definition: AgentDefinition
|