@ampcode/plugin 0.0.0-20260816001043-ge65dd2b → 0.0.0-20260818001058-gcb0a91a
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 +105 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -341,7 +341,7 @@ declare module '@ampcode/plugin' {
|
|
|
341
341
|
* Run `amp plugins show-agent-options --json` for the public model IDs intended for
|
|
342
342
|
* plugin agents.
|
|
343
343
|
*/
|
|
344
|
-
model:
|
|
344
|
+
model: PluginAgentModel
|
|
345
345
|
/** Instructions appended to Amp's base agent prompt. */
|
|
346
346
|
instructions: string
|
|
347
347
|
/**
|
|
@@ -561,6 +561,12 @@ declare module '@ampcode/plugin' {
|
|
|
561
561
|
/** Model identifier in `provider/model` format, such as `openai/gpt-5.6-sol`. */
|
|
562
562
|
export type PluginAIModel = `${PluginAIModelProvider}/${string}`
|
|
563
563
|
|
|
564
|
+
/**
|
|
565
|
+
* Model identifier for a custom agent. Providers outside Amp's built-in set require a matching
|
|
566
|
+
* AI router configured for the account at inference time.
|
|
567
|
+
*/
|
|
568
|
+
export type PluginAgentModel = `${string}/${string}`
|
|
569
|
+
|
|
564
570
|
export type PluginAIFieldSchema = {
|
|
565
571
|
type: string | string[]
|
|
566
572
|
description?: string
|
|
@@ -1662,6 +1668,12 @@ declare module '@ampcode/plugin' {
|
|
|
1662
1668
|
/** Tool name (must match ^[a-zA-Z0-9_-]+$) */
|
|
1663
1669
|
name: string
|
|
1664
1670
|
|
|
1671
|
+
/**
|
|
1672
|
+
* Human-readable display title shown in Amp clients instead of the raw
|
|
1673
|
+
* tool name, e.g. `Tap screen` instead of `sim_tap`. Not sent to the LLM.
|
|
1674
|
+
*/
|
|
1675
|
+
title?: string
|
|
1676
|
+
|
|
1665
1677
|
/** Description shown to the LLM explaining what the tool does */
|
|
1666
1678
|
description: string
|
|
1667
1679
|
|
|
@@ -1687,4 +1699,96 @@ declare module '@ampcode/plugin' {
|
|
|
1687
1699
|
/** Path to the skill directory, relative to the directory plugin's root. */
|
|
1688
1700
|
path: string
|
|
1689
1701
|
}
|
|
1702
|
+
|
|
1703
|
+
/**
|
|
1704
|
+
* Config for a declarative agent, the argument to {@link defineAgent} in an agent directory's
|
|
1705
|
+
* `agent.ts`. Amp parses this object statically, so it must be a plain object literal of
|
|
1706
|
+
* string, number, boolean, array, and object literals — no imports, variables, or computed
|
|
1707
|
+
* values. The file is required in every agent directory, but every config field is optional;
|
|
1708
|
+
* `defineAgent({})` is a complete config.
|
|
1709
|
+
*/
|
|
1710
|
+
export interface AgentConfig {
|
|
1711
|
+
/** Label shown in mode pickers and thread headers, 24 characters or less. Defaults to the agent's directory name. */
|
|
1712
|
+
label?: string
|
|
1713
|
+
/** Description shown in agent listings, 500 characters or less. */
|
|
1714
|
+
description?: string
|
|
1715
|
+
/** Label color as a hex RGB string, for example "#d97706". */
|
|
1716
|
+
color?: string
|
|
1717
|
+
/**
|
|
1718
|
+
* Model identifier in `provider/model` format, such as `anthropic/claude-sonnet-4-6`.
|
|
1719
|
+
* Omit to use the default model.
|
|
1720
|
+
*/
|
|
1721
|
+
model?: PluginAIModel
|
|
1722
|
+
/** Run entirely on Amp's thread actor without creating or attaching an executor. */
|
|
1723
|
+
serverOnly?: boolean
|
|
1724
|
+
/**
|
|
1725
|
+
* Built-in tools available to this agent: 'all' for all tools available in its runtime,
|
|
1726
|
+
* or a list of tool names with `*` suffix wildcards.
|
|
1727
|
+
*/
|
|
1728
|
+
tools?: 'all' | readonly string[]
|
|
1729
|
+
/** Optional reasoning effort override for models that support it. */
|
|
1730
|
+
reasoningEffort?: AgentReasoningEffort
|
|
1731
|
+
/** Features required on threads created from this agent. */
|
|
1732
|
+
features?: readonly AgentFeature[]
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
/**
|
|
1736
|
+
* Declare a declarative agent's config in its directory's `agent.ts`:
|
|
1737
|
+
*
|
|
1738
|
+
* ```ts
|
|
1739
|
+
* import { defineAgent } from '@ampcode/plugin'
|
|
1740
|
+
*
|
|
1741
|
+
* export default defineAgent({
|
|
1742
|
+
* description: 'Researches requests and cites primary sources',
|
|
1743
|
+
* model: 'openai/gpt-5-mini',
|
|
1744
|
+
* tools: ['web_search', 'read_web_page'],
|
|
1745
|
+
* reasoningEffort: 'medium',
|
|
1746
|
+
* })
|
|
1747
|
+
* ```
|
|
1748
|
+
*
|
|
1749
|
+
* Returns the config unchanged; it exists for typing and static parsing.
|
|
1750
|
+
*/
|
|
1751
|
+
export function defineAgent(config: AgentConfig): AgentConfig
|
|
1752
|
+
|
|
1753
|
+
/**
|
|
1754
|
+
* A custom tool declared in an agent directory's `tools/<name>.ts` file, the argument to
|
|
1755
|
+
* {@link defineTool}. The tool's name is the filename. The `description` and `execution`
|
|
1756
|
+
* fields must be static literals; `inputSchema` and `execute` are real code that is not
|
|
1757
|
+
* statically parsed and runs where `execution` places it.
|
|
1758
|
+
*/
|
|
1759
|
+
export interface AgentToolConfig {
|
|
1760
|
+
/** Description shown to the LLM explaining what the tool does */
|
|
1761
|
+
description?: string
|
|
1762
|
+
|
|
1763
|
+
/**
|
|
1764
|
+
* Where the tool executes. `server` tools run where the agent runs (its sandbox, no
|
|
1765
|
+
* repository checkout needed); `executor` tools are dispatched to the attached executor
|
|
1766
|
+
* at the repository checkout. Defaults to `server`.
|
|
1767
|
+
*/
|
|
1768
|
+
execution?: 'server' | 'executor'
|
|
1769
|
+
|
|
1770
|
+
/** JSON Schema for the tool's input parameters */
|
|
1771
|
+
inputSchema: PluginToolDefinition['inputSchema']
|
|
1772
|
+
|
|
1773
|
+
/** Execute the tool with the given input and return a result */
|
|
1774
|
+
execute: PluginToolDefinition['execute']
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
/**
|
|
1778
|
+
* Declare a custom tool in an agent directory's `tools/<name>.ts`:
|
|
1779
|
+
*
|
|
1780
|
+
* ```ts
|
|
1781
|
+
* import { defineTool } from '@ampcode/plugin'
|
|
1782
|
+
*
|
|
1783
|
+
* export default defineTool({
|
|
1784
|
+
* description: 'Fetch open tickets',
|
|
1785
|
+
* execution: 'server',
|
|
1786
|
+
* inputSchema: { type: 'object', properties: { query: { type: 'string' } } },
|
|
1787
|
+
* execute: async (input) => ({ content: [{ type: 'text', text: JSON.stringify(input) }] }),
|
|
1788
|
+
* })
|
|
1789
|
+
* ```
|
|
1790
|
+
*
|
|
1791
|
+
* Returns the tool unchanged; it exists for typing and static parsing.
|
|
1792
|
+
*/
|
|
1793
|
+
export function defineTool(tool: AgentToolConfig): AgentToolConfig
|
|
1690
1794
|
}
|