@ampcode/plugin 0.0.0-20260817001132-gbee24f5 → 0.0.0-20260818221056-gdf9ae7e
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 +119 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -354,6 +354,12 @@ declare module '@ampcode/plugin' {
|
|
|
354
354
|
tools?: AgentToolSelection
|
|
355
355
|
/** Optional reasoning effort override for models that support it. */
|
|
356
356
|
reasoningEffort?: AgentReasoningEffort
|
|
357
|
+
/**
|
|
358
|
+
* Estimated input-token count at which Amp automatically compacts the thread.
|
|
359
|
+
* Must be a positive safe integer. When omitted, Amp uses the configured
|
|
360
|
+
* percentage threshold, which defaults to 90%.
|
|
361
|
+
*/
|
|
362
|
+
compactionThresholdTokens?: number
|
|
357
363
|
/**
|
|
358
364
|
* Features required on threads created from this agent. Omit this field to inherit
|
|
359
365
|
* the creating thread's features when the caller also omits
|
|
@@ -491,7 +497,10 @@ declare module '@ampcode/plugin' {
|
|
|
491
497
|
* agent has no display.
|
|
492
498
|
*/
|
|
493
499
|
label?: string
|
|
494
|
-
/**
|
|
500
|
+
/**
|
|
501
|
+
* Optional longer description shown in command palettes and pickers. State both what the
|
|
502
|
+
* mode does and when to use it.
|
|
503
|
+
*/
|
|
495
504
|
description?: string
|
|
496
505
|
/**
|
|
497
506
|
* Optional label color as a hex RGB string, for example "#d97706".
|
|
@@ -1067,6 +1076,20 @@ declare module '@ampcode/plugin' {
|
|
|
1067
1076
|
*/
|
|
1068
1077
|
cancel(): Promise<void>
|
|
1069
1078
|
|
|
1079
|
+
/**
|
|
1080
|
+
* Make this thread private or visible to every member of its workspace.
|
|
1081
|
+
* Making a thread private closes multiplayer. The authenticated user must
|
|
1082
|
+
* own the thread.
|
|
1083
|
+
*/
|
|
1084
|
+
setVisibility(visibility: 'private' | 'workspace'): Promise<void>
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* Open multiplayer for the given number of seconds, or close it with `null`.
|
|
1088
|
+
* Opening multiplayer requires an Orb thread that is already shared. Valid
|
|
1089
|
+
* durations range from 5 minutes to 7 days.
|
|
1090
|
+
*/
|
|
1091
|
+
setMultiplayer(options: { ttlSeconds: number | null }): Promise<void>
|
|
1092
|
+
|
|
1070
1093
|
/**
|
|
1071
1094
|
* Read messages from the thread in a stable plugin-facing schema.
|
|
1072
1095
|
*
|
|
@@ -1699,4 +1722,99 @@ declare module '@ampcode/plugin' {
|
|
|
1699
1722
|
/** Path to the skill directory, relative to the directory plugin's root. */
|
|
1700
1723
|
path: string
|
|
1701
1724
|
}
|
|
1725
|
+
|
|
1726
|
+
/**
|
|
1727
|
+
* Config for a declarative agent, the argument to {@link defineAgent} in an agent directory's
|
|
1728
|
+
* `agent.ts`. Amp parses this object statically, so it must be a plain object literal of
|
|
1729
|
+
* string, number, boolean, array, and object literals — no imports, variables, or computed
|
|
1730
|
+
* values. The file is required in every agent directory, but every config field is optional;
|
|
1731
|
+
* `defineAgent({})` is a complete config.
|
|
1732
|
+
*/
|
|
1733
|
+
export interface AgentConfig {
|
|
1734
|
+
/** Label shown in mode pickers and thread headers, 24 characters or less. Defaults to the agent's directory name. */
|
|
1735
|
+
label?: string
|
|
1736
|
+
/**
|
|
1737
|
+
* Description shown in agent listings, 500 characters or less. State both what the agent
|
|
1738
|
+
* does and when to use it.
|
|
1739
|
+
*/
|
|
1740
|
+
description?: string
|
|
1741
|
+
/** Label color as a hex RGB string, for example "#d97706". */
|
|
1742
|
+
color?: string
|
|
1743
|
+
/**
|
|
1744
|
+
* Model identifier in `provider/model` format, such as `anthropic/claude-sonnet-4-6`.
|
|
1745
|
+
* Omit to use the default model.
|
|
1746
|
+
*/
|
|
1747
|
+
model?: PluginAIModel
|
|
1748
|
+
/** Run entirely on Amp's thread actor without creating or attaching an executor. */
|
|
1749
|
+
serverOnly?: boolean
|
|
1750
|
+
/**
|
|
1751
|
+
* Built-in tools available to this agent: 'all' for all tools available in its runtime,
|
|
1752
|
+
* or a list of tool names with `*` suffix wildcards.
|
|
1753
|
+
*/
|
|
1754
|
+
tools?: 'all' | readonly string[]
|
|
1755
|
+
/** Optional reasoning effort override for models that support it. */
|
|
1756
|
+
reasoningEffort?: AgentReasoningEffort
|
|
1757
|
+
/** Features required on threads created from this agent. */
|
|
1758
|
+
features?: readonly AgentFeature[]
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
/**
|
|
1762
|
+
* Declare a declarative agent's config in its directory's `agent.ts`:
|
|
1763
|
+
*
|
|
1764
|
+
* ```ts
|
|
1765
|
+
* import { defineAgent } from '@ampcode/plugin'
|
|
1766
|
+
*
|
|
1767
|
+
* export default defineAgent({
|
|
1768
|
+
* description: 'Researches requests and cites primary sources. Use for evidence-backed research.',
|
|
1769
|
+
* model: 'openai/gpt-5-mini',
|
|
1770
|
+
* tools: ['web_search', 'read_web_page'],
|
|
1771
|
+
* reasoningEffort: 'medium',
|
|
1772
|
+
* })
|
|
1773
|
+
* ```
|
|
1774
|
+
*
|
|
1775
|
+
* Returns the config unchanged; it exists for typing and static parsing.
|
|
1776
|
+
*/
|
|
1777
|
+
export function defineAgent(config: AgentConfig): AgentConfig
|
|
1778
|
+
|
|
1779
|
+
/**
|
|
1780
|
+
* A custom tool declared in an agent directory's `tools/<name>.ts` file, the argument to
|
|
1781
|
+
* {@link defineTool}. The tool's name is the filename. The `description` and `execution`
|
|
1782
|
+
* fields must be static literals; `inputSchema` and `execute` are real code that is not
|
|
1783
|
+
* statically parsed and runs where `execution` places it.
|
|
1784
|
+
*/
|
|
1785
|
+
export interface AgentToolConfig {
|
|
1786
|
+
/** Description shown to the LLM explaining what the tool does */
|
|
1787
|
+
description?: string
|
|
1788
|
+
|
|
1789
|
+
/**
|
|
1790
|
+
* Where the tool executes. `server` tools run where the agent runs (its sandbox, no
|
|
1791
|
+
* repository checkout needed); `executor` tools are dispatched to the attached executor
|
|
1792
|
+
* at the repository checkout. Defaults to `server`.
|
|
1793
|
+
*/
|
|
1794
|
+
execution?: 'server' | 'executor'
|
|
1795
|
+
|
|
1796
|
+
/** JSON Schema for the tool's input parameters */
|
|
1797
|
+
inputSchema: PluginToolDefinition['inputSchema']
|
|
1798
|
+
|
|
1799
|
+
/** Execute the tool with the given input and return a result */
|
|
1800
|
+
execute: PluginToolDefinition['execute']
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
/**
|
|
1804
|
+
* Declare a custom tool in an agent directory's `tools/<name>.ts`:
|
|
1805
|
+
*
|
|
1806
|
+
* ```ts
|
|
1807
|
+
* import { defineTool } from '@ampcode/plugin'
|
|
1808
|
+
*
|
|
1809
|
+
* export default defineTool({
|
|
1810
|
+
* description: 'Fetch open tickets',
|
|
1811
|
+
* execution: 'server',
|
|
1812
|
+
* inputSchema: { type: 'object', properties: { query: { type: 'string' } } },
|
|
1813
|
+
* execute: async (input) => ({ content: [{ type: 'text', text: JSON.stringify(input) }] }),
|
|
1814
|
+
* })
|
|
1815
|
+
* ```
|
|
1816
|
+
*
|
|
1817
|
+
* Returns the tool unchanged; it exists for typing and static parsing.
|
|
1818
|
+
*/
|
|
1819
|
+
export function defineTool(tool: AgentToolConfig): AgentToolConfig
|
|
1702
1820
|
}
|